This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/rabbitmq #99
Merged
Merged
Feature/rabbitmq #99
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
71051e4
worker consumindo de uma fila rabbitmq
vitor-lupinetti c268b8a
RabbitMq service
aoliveiramateus c4747f7
Merge branch 'develop' into feature/rabbitmq
aoliveiramateus d34fefd
configuração rabbitmq no kubernetes, ajustes na aplicação e adição de…
vitor-lupinetti 2aa9f80
refatorações
vitor-lupinetti 49d87be
criação de volume para rabbitmq e refatoração do consumer para o rabb…
vitor-lupinetti 63ee8a3
ajuste rabbitmq e options patterns
aoliveiramateus 091cf36
Merge branch 'develop' into feature/rabbitmq
vitor-lupinetti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: rabbitmq | ||
namespace: techlanches | ||
spec: | ||
ports: | ||
- port: 5672 | ||
name: amqp | ||
- port: 15672 | ||
name: http | ||
selector: | ||
app: rabbitmq | ||
type: LoadBalancer | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: rabbitmq | ||
namespace: techlanches | ||
spec: | ||
serviceName: "rabbitmq" | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: rabbitmq | ||
template: | ||
metadata: | ||
labels: | ||
app: rabbitmq | ||
spec: | ||
hostname: techlanches | ||
containers: | ||
- name: rabbitmq | ||
image: rabbitmq:management | ||
ports: | ||
- containerPort: 5672 | ||
- containerPort: 15672 | ||
env: | ||
- name: RABBITMQ_DEFAULT_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: techlanches-secrets | ||
key: RABBITMQ_DEFAULT_USER | ||
- name: RABBITMQ_DEFAULT_PASS | ||
valueFrom: | ||
secretKeyRef: | ||
name: techlanches-secrets | ||
key: RABBITMQ_DEFAULT_PASS | ||
volumeMounts: | ||
- name: rabbit-data | ||
mountPath: /var/lib/rabbitmq/mnesia | ||
|
||
volumes: | ||
- name: rabbit-data | ||
persistentVolumeClaim: | ||
claimName: rabbit-data | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: rabbit-data | ||
namespace: techlanches | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 5Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...chLanches/Adapter/Driven/TechLanches.Adapter.ACL.Pagamento.QrCode/Constantes/Constante.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TechLanches.Adapter.ACL.Pagamento.QrCode.Constantes | ||
{ | ||
public static class MercadoPagoConstantes | ||
{ | ||
public const string MERCADO_PAGO = "MercadoPago"; | ||
public const string STATUS_APROVADO = "approved"; | ||
public const string STATUS_REPROVADO = "repproved"; | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
...en/TechLanches.Adapter.ACL.Pagamento.QrCode/Provedores/MercadoPago/IMercadoPagoService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/TechLanches/Adapter/Driver/TechLanches.Adapter.API/Health/RabbitMQHealthCheck.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
using RabbitMQ.Client; | ||
|
||
namespace TechLanches.Adapter.API.Health | ||
{ | ||
public class RabbitMQHealthCheck : IHealthCheck | ||
{ | ||
private readonly string _rabbitHost; | ||
private readonly string _rabbitUser; | ||
private readonly string _rabbitPassword; | ||
|
||
public RabbitMQHealthCheck(IConfiguration configuration) | ||
{ | ||
_rabbitHost = configuration.GetSection("RabbitMQ:Host").Value; | ||
_rabbitUser = configuration.GetSection("RabbitMQ:User").Value; | ||
_rabbitPassword = configuration.GetSection("RabbitMQ:Password").Value; | ||
} | ||
|
||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) | ||
{ | ||
try | ||
{ | ||
var factory = new ConnectionFactory { HostName = _rabbitHost, UserName = _rabbitUser, Password = _rabbitPassword }; | ||
|
||
using (var connection = factory.CreateConnection()) | ||
using (var channel = connection.CreateModel()) | ||
{ | ||
// Verifica se a conexão e o canal com o RabbitMQ podem ser estabelecidos | ||
if (connection.IsOpen && channel.IsOpen) | ||
{ | ||
return HealthCheckResult.Healthy("RabbitMQ is reachable."); | ||
} | ||
else | ||
{ | ||
return HealthCheckResult.Unhealthy("Unable to connect to RabbitMQ."); | ||
} | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
return HealthCheckResult.Unhealthy($"Exception during RabbitMQ health check: {ex.Message}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linha comentada