Try PubSub+

Get topic name from the incoming message using solace spring cloud stream library

matthesumatthesu Unconfirmed, Member Posts: 13

Following is a sample bean to receive messages from a solace queue. How can I get the topic name through which the message came into my queue?
This queue is configured to receive messages from multiple topics and based on the topic of each message I have different message processing logic.
I was able to get the topic name using this.message.getDestination().getName() method when I was using sol-jcsmp library.
In spring cloud stream library, how can I get this information?
@Bean
public Consumer<Message<?>> logMsg() {
return message-> {
System.out.println("Received: " + message);
};
}

Comments

  • marcmarc Member, Administrator, Moderator, Employee Posts: 336 admin

    Hi @matthesu,
    This is currently a short coming of the binder. We have this issue opened in github to track it and the plan is to enhance the binder with this functionality in the release after next. If you could get your team to open a support ticket to request this functionality that would help me get it prioritized :)

    Note the next release will be available soon ( within a week I'm thinking🤞) with support for publishing to dynamic topics and consumer concurrency.

    -Marc

Sign In or Register to comment.