how to set correlation id via Message Service Api
how to set correlation id via Message Service Api, i tried using solace.messaging.message.correlation-id while preparing message builder, but always creating REQ0,REQ1 etc, could n't able to get my custom generated correlation id
I need this correlation id for Req-Reply pattern, here the sample code
outboundMessage = messageBuilder.withProperty(SolaceProperties.MessageProperties.CORRELATION_ID,messageKey).build(messageContent);
inboundMessage = requestReplyMessagePublisher.publishAwaitResponse(outboundMessage, Topic.of(solaceMessagingSession.getLocalTopic()),
CmSolaceConstants.PUB_REQUEST_TIMEOUT_MS);
Answers
-
Looking at the code, I assume you are using Java API.
One of the option is to pass the additionalMessageProperties while publishing a message…
or
using the
OutboundMessageBuilder.fromProperties(Properties properties)
method//MessagingService servicce = .... final OutboundMessageBuilder messageBuilder = service.messageBuilder(); final OutboundMessage m = messageBuilder.build(messagePayload); final Properties properties = new Properties(); properties.setProperty(MessageProperties.CORRELATION_ID, correlationId); properties.setProperty(MessageProperties.APPLICATION_MESSAGE_TYPE, messageType); properties.setProperty(customKey, myValue); publisher.publish(m, t1, properties);
0 -
Thank you, What will be the Message type here? Persistent/non-persistent or data type like string?
0 -
Thank you , Its working perfect , i can able to publish message with custom key now
0