public interface MessageProducerInterceptor
send
method from a MessageProducer
interface or its implementations.
This interface can be used by a JMS application to transparently change any of the JMS supported publishing
parameter like, the message (incl, its content), message destination, delivery mode, message priority, etc.
Implementation of this interface can be activated programmatically specifying SupportedProperty.SOLACE_JMS_MESSAGE_PRODUCER_INTERCEPTOR_CLASS_NAME
using JMS environment properties
passed to InitialContext
or via JNDI Properties File with a key
"Solace_JMS_MessageProducerInterceptorClassName". It is also possible to set it via a system property
"Solace_JMS_MessageProducerInterceptorClassName".
Interceptor instantiation policy is "per instance of the JMS producer"
Implementation of this interceptor require to have a public
default constructor, that
will be used for instantiation using reflection.
This interceptor can be used for cross cutting concerns like logging, validation, encryption etc..
Implementation of this interface needs to be on application classpath.
Modifier and Type | Interface and Description |
---|---|
static interface |
MessageProducerInterceptor.MessageProducerInterceptingContext
Represents a mutable intercepting context associated with a single message publishing/send
event.
|
Modifier and Type | Method and Description |
---|---|
void |
onPrePublish(MessageProducerInterceptor.MessageProducerInterceptingContext interceptingContext)
This method is executed after every call to send a message using
MessageProducer before
message is processed by the underlying Solace JMS API and send to its destination. |
void onPrePublish(MessageProducerInterceptor.MessageProducerInterceptingContext interceptingContext) throws javax.jms.JMSException
MessageProducer
before
message is processed by the underlying Solace JMS API and send to its destination.
Implementation expected to be non-blocking and should exit as soon as possible.interceptingContext
- mutable intercepting context associated with a single act of sending
a messagejavax.jms.JMSException
- can be thrown from the interceptor code to signal to the Solace JMS API
that the particular message can't be published. When interceptor code
throws an Exception it is propagated to the user as is. Any thrown
exception has same consequences for the transaction handling as if it is
thrown from a MessageProducer.send(Message)
Copyright 2004-2024 Solace Corporation. All rights reserved.