public class PublishOperation extends Object
| Constructor and Description |
|---|
PublishOperation() |
| Modifier and Type | Method and Description |
|---|---|
void |
publishMessage(PubSubConfiguration config,
PubSubConnection connection,
TopicIdentifier topicIdentifier,
MessageContent messageContent,
String orderingKey,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<String,Void> callback)
Publishes a single message.
|
@DisplayName(value="Publish Message")
@MediaType(value="text/plain")
@Throws(value={CommonErrorTypeProvider.class,PublishErrorTypeProvider.class})
@Summary(value="Publish message and attributes to selected topic")
public void publishMessage(@Config
PubSubConfiguration config,
@Connection
PubSubConnection connection,
@ParameterGroup(name="Topic settings") @MetadataKeyId
TopicIdentifier topicIdentifier,
@ParameterGroup(name="Message content")
MessageContent messageContent,
@Optional
String orderingKey,
org.mule.runtime.extension.api.runtime.process.CompletionCallback<String,Void> callback)
In case batching is enabled, the message is only stored locally until any of the batching restrictions are reached.
The publish operation allows for high throughput, as a side effect of this, when using orderingKey your messages are not guaranteed to be processed, in the order they were called, especially in threaded environment. In case you absolutely need to maintain a strict order it is advised to use "Max Concurrency" of "1" in your sources flow settings and to add a delay in your ForEach loops when they contain order critical Publish calls. returns a messageId which is the unique identifier of sent message within the topic
config - configurationconnection - connectionmessageContent - Message content, containing either message data or attributes.orderingKey - If non-empty, identifies related messages for which publish order should be respected. This key is respected when the subscriber has enabled message ordering.Copyright © 2021 MuleSoft, Inc.. All rights reserved.