|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Does IBM MQ provide any Interceptor for Spring Framework? |
« View previous topic :: View next topic » |
Author |
Message
|
issac |
Posted: Sun Sep 26, 2021 5:43 pm Post subject: Does IBM MQ provide any Interceptor for Spring Framework? |
|
|
 Disciple
Joined: 02 Oct 2008 Posts: 158 Location: Shanghai
|
Hello, experts
Does IBM MQ provide any Interceptor for Spring Framework, which logs the message to send and to receive?
I found a project on IBM MQ & Spring integration: https://github.com/ibm-messaging/mq-jms-spring
However it doesn't seem to come with an interceptor of any sort.
If there's no existing interceptor for the work, I plan to write one. Like the example bellow, which is for RabbitMQ.
/**
* @see org.springframework.amqp.core.AmqpTemplate#send(Message)
*/
@Around(value = "execution(* org.springframework.amqp.core.AmqpTemplate.send(..)) && args(message)",
argNames = "pjp,message")
public Object traceRabbitSend(ProceedingJoinPoint pjp, Object message) throws Throwable {
return createSofaTracerHolder()
.doWithTracingHeadersMessage(this.exchange, this.routingKey, message, (convertedMessage) ->
proceedReplacingMessage(pjp, convertedMessage, 0));
}
The @Around annotation will call my code before a given method. My plan is to add message-logging before any MQ PUT/GET operation.
I've discovered these methods, please correct me if anything is amiss.
BASE API:
com.ibm.mq.MQQueue.put()
com.ibm.mq.MQQueue.get()
JMS API:
javax.jms.MessageProducer.send()
com.ibm.mq.jms.MQMessageConsumer.receive()
com.ibm.mq.jms.MQTopicPublisher.publish()
javax.jms.MessageListener.onMessage()
Q2: If I have to write my own interceptors, is there any more basic or even internal method, which is shared underneath these methods, for message PUT/GET? If I can learn the name of such deep methods, the interceptors I write can work more efficiently.
Thank you.
Song _________________ Bazinga! |
|
Back to top |
|
 |
hughson |
Posted: Sun Sep 26, 2021 6:55 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
If you want to log all the puts and gets, why not take a look at the IBM-supplied API exit that logs all the API calls. It can be enhanced to only log specific APIs if that is what you need by removing the registration of the entrypoints you are not interested in.
Take a look at amqsaxe0.c in the samples directory, and read The API exit sample program
This exit intercepts that API calls at the lowest level, the MQI. The classes you mention are several levels above that point. It also already exists and you can use it immediately.
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
issac |
Posted: Tue Sep 28, 2021 5:13 pm Post subject: |
|
|
 Disciple
Joined: 02 Oct 2008 Posts: 158 Location: Shanghai
|
Enlightening! Thanks! I'm learning it now.
Song _________________ Bazinga! |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|