Interceptors with Solace JMS

marc
marc Member, Administrator, Moderator, Employee Posts: 960 admin
edited May 2022 in Tips and Tricks #1

I just wanted to highlight a new feature that was added to Solace JMS v10.14.0.

The API now allows for "pre-send" and "pre-receive" interceptors (AKA hooks). This allows a developer to implement common logic in one place and add it into the sending/receiving of multiple apps. A common use case for this would be for logging or handling security concerns.


Check out the docs for examples!

* Pre-Send Interceptors implement MessageProducerInteceptor and activate the interface using SupportedProperty.SOLACE_SOLACE_JMS_MESSAGE_PRODUCER_INTERCEPTOR_CLASS_NAME

https://docs.solace.com/API/Solace-JMS-API/Sending-Messages.htm?Highlight=sending%20messages

* Pre-Receive Interceptors implement MessageReceiverInterceptor and active the interface using SupportedProperty.SOLACE_JMS_MESSAGE_CONSUMER_INTERCEPTOR_CLASS_NAME

https://docs.solace.com/API/Solace-JMS-API/Receiving-Messages.htm?Highlight=receiving%20messages


Hope that helps some folks out :)

Tagged:

Comments

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin
    edited January 2023 #2

    Bump to the top! We were just talking about this yesterday on my Office Hours. I didn't realize how long ago this was added. It makes sense that JMS has this but our other APIs don't, since a lot of customers use JMS with apps such as Tibco BusinessWorks or Camel. Cannot always be writing code in the message handlers. This allows you to add a JAR to the classpath and have your code called automatically. Pretty awesome! Lots of good use cases for this: logging, stats, telemetry, validation, etc.