ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Does IBM MQ provide any Interceptor for Spring Framework?

Post new topic  Reply to topic
 Does IBM MQ provide any Interceptor for Spring Framework? « View previous topic :: View next topic » 
Author Message
issac
PostPosted: Sun Sep 26, 2021 5:43 pm    Post subject: Does IBM MQ provide any Interceptor for Spring Framework? Reply with quote

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
View user's profile Send private message
hughson
PostPosted: Sun Sep 26, 2021 6:55 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
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
View user's profile Send private message Visit poster's website
issac
PostPosted: Tue Sep 28, 2021 5:13 pm    Post subject: Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

Enlightening! Thanks! I'm learning it now.

Song
_________________
Bazinga!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Does IBM MQ provide any Interceptor for Spring Framework?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.