Class AzurePublisher
java.lang.Object
org.chenile.pubsub.azure.pub.AzurePublisher
- All Implemented Interfaces:
ChenilePub
Azure-based implementation of the
ChenilePub interface.
Provides methods to publish messages to Azure hub topics synchronously or asynchronously.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChenileEventHubPropertiesprivate final List<PubSubMessageInterceptor> private final PubSubInfoProvider -
Constructor Summary
ConstructorsConstructorDescriptionAzurePublisher(PubSubInfoProvider pubSubInfoProvider, ChenileEventHubProperties chenileEventHubProperties) AzurePublisher(PubSubInfoProvider pubSubInfoProvider, ChenileEventHubProperties chenileEventHubProperties, List<PubSubMessageInterceptor> interceptors) -
Method Summary
Modifier and TypeMethodDescriptionprivate PubSubMessageprivate static voidapplyPartitionRouting(com.azure.messaging.eventhubs.models.CreateBatchOptions options, Map<String, Object> properties) Configures default, explicit-ID, Azure-keyed, or automatic Event Hubs routing.voidPublishes a message asynchronously to the given Kafka topic.buildHeaders(String topic, Map<String, Object> properties) Builds Kafka headers from message properties and adds the Chenile topic key.private static StringgetPartitionId(Map<String, Object> properties) Extracts an explicit partition number.private static StringgetPartitionKey(Map<String, Object> properties) private static StringgetPartitionMode(Map<String, Object> properties) voidPublishes a message to the global Kafka topic.voidpublishToOperation(String service, String operationName, String payload, Map<String, Object> properties) Publishes a message to the given service's operation topic.private voidprivate static StringsubstituteProperties(String text, Map<String, Object> properties) Replaces placeholders in a string with values from the given properties map.
-
Field Details
-
pubSubInfoProvider
-
chenileEventHubProperties
-
interceptors
-
producerClients
@Autowired private Map<String, com.azure.messaging.eventhubs.EventHubProducerClient> producerClients
-
-
Constructor Details
-
AzurePublisher
public AzurePublisher(PubSubInfoProvider pubSubInfoProvider, ChenileEventHubProperties chenileEventHubProperties) -
AzurePublisher
public AzurePublisher(PubSubInfoProvider pubSubInfoProvider, ChenileEventHubProperties chenileEventHubProperties, List<PubSubMessageInterceptor> interceptors)
-
-
Method Details
-
publishToOperation
public void publishToOperation(String service, String operationName, String payload, Map<String, Object> properties) Publishes a message to the given service's operation topic.- Specified by:
publishToOperationin interfaceChenilePub- Parameters:
service- the service nameoperationName- the operation namepayload- the message payloadproperties- additional message properties
-
asyncPublish
Publishes a message asynchronously to the given Kafka topic.- Specified by:
asyncPublishin interfaceChenilePub- Parameters:
topic- the Kafka topicpayload- the message payloadproperties- additional message properties
-
sendMessage
-
publish
Publishes a message to the global Kafka topic.- Specified by:
publishin interfaceChenilePub- Parameters:
topic- logical topic name (added as header, not used as Kafka topic)payload- the message payloadproperties- additional message properties
-
buildHeaders
-
substituteProperties
-
applyPartitionRouting
-
getPartitionId
-
getPartitionKey
-
getPartitionMode
-
applyBeforePublishInterceptors
-
CHENILE