You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: Support Azure SB for publishmq
* chore: Configure publishmq in emulator for local dev & local publishmq helper
* chore: rename file to specify mq services
returnfmt.Errorf("failed to create sender: %w", err)
31
+
}
32
+
defersender.Close(ctx)
33
+
34
+
messageBody, err:=json.Marshal(body)
35
+
iferr!=nil {
36
+
returnerr
37
+
}
38
+
39
+
message:=&azservicebus.Message{
40
+
Body: messageBody,
41
+
ApplicationProperties: map[string]interface{}{
42
+
"source": "outpost-publish",
43
+
},
44
+
}
45
+
46
+
err=sender.SendMessage(ctx, message, nil)
47
+
iferr!=nil {
48
+
returnfmt.Errorf("failed to send message: %w", err)
49
+
}
50
+
51
+
log.Printf("[x] Published message to Azure Service Bus topic %s", AzureServiceBusTopic)
52
+
returnnil
53
+
}
54
+
55
+
funcdeclareAzureServiceBus() error {
56
+
log.Printf("[*] Declaring Azure Service Bus Publish infra")
57
+
returnfmt.Errorf("azure sb emulator does not support declaring topics and subscriptions. Use `%s` and `%s` for the publishmq topic and subscription", AzureServiceBusTopic, AzureServiceBusSubscription)
Copy file name to clipboardExpand all lines: internal/config/publishmq.go
+25-3Lines changed: 25 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,12 @@ type PublishAWSSQSConfig struct {
14
14
Queuestring`yaml:"queue" env:"PUBLISH_AWS_SQS_QUEUE" desc:"Name of the SQS queue for publishing events. Required if AWS SQS is the chosen publish MQ provider." required:"C"`
15
15
}
16
16
17
+
typePublishAzureServiceBusConfigstruct {
18
+
ConnectionStringstring`yaml:"connection_string" env:"PUBLISH_AZURE_SERVICEBUS_CONNECTION_STRING" desc:"Azure Service Bus connection string for the publish queue. Required if Azure Service Bus is the chosen publish MQ provider." required:"C"`
19
+
Topicstring`yaml:"topic" env:"PUBLISH_AZURE_SERVICEBUS_TOPIC" desc:"Name of the Azure Service Bus topic for publishing events. Required if Azure Service Bus is the chosen publish MQ provider." required:"C"`
20
+
Subscriptionstring`yaml:"subscription" env:"PUBLISH_AZURE_SERVICEBUS_SUBSCRIPTION" desc:"Name of the Azure Service Bus subscription to read published events from. Required if Azure Service Bus is the chosen publish MQ provider." required:"C"`
21
+
}
22
+
17
23
typePublishGCPPubSubConfigstruct {
18
24
Projectstring`yaml:"project" env:"PUBLISH_GCP_PUBSUB_PROJECT" desc:"GCP Project ID for the Pub/Sub publish topic. Required if GCP Pub/Sub is the chosen publish MQ provider." required:"C"`
19
25
Topicstring`yaml:"topic" env:"PUBLISH_GCP_PUBSUB_TOPIC" desc:"Name of the GCP Pub/Sub topic for publishing events. Required if GCP Pub/Sub is the chosen publish MQ provider." required:"C"`
@@ -28,15 +34,19 @@ type PublishRabbitMQConfig struct {
28
34
}
29
35
30
36
typePublishMQConfigstruct {
31
-
AWSSQSPublishAWSSQSConfig`yaml:"aws_sqs" desc:"Configuration for using AWS SQS as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
32
-
GCPPubSubPublishGCPPubSubConfig`yaml:"gcp_pubsub" desc:"Configuration for using GCP Pub/Sub as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
33
-
RabbitMQPublishRabbitMQConfig`yaml:"rabbitmq" desc:"Configuration for using RabbitMQ as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
37
+
AWSSQSPublishAWSSQSConfig`yaml:"aws_sqs" desc:"Configuration for using AWS SQS as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
38
+
AzureServiceBusPublishAzureServiceBusConfig`yaml:"azure_servicebus" desc:"Configuration for using Azure Service Bus as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
39
+
GCPPubSubPublishGCPPubSubConfig`yaml:"gcp_pubsub" desc:"Configuration for using GCP Pub/Sub as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
40
+
RabbitMQPublishRabbitMQConfig`yaml:"rabbitmq" desc:"Configuration for using RabbitMQ as the publish message queue. Only one publish MQ provider should be configured." required:"N"`
0 commit comments