activemq - Determining destination of JMS Message with AspectJ -


i've created following pointcut calls javax.jms.messageproducer.send(..):

pointcut calljmssend(message message):     (call(void javax.jms.messageproducer.send(javax.jms.message)))    && args(message); 

which works fine. have both before , after advice pointcut (amongst other things) reads jmsdestination property.

before(message message): calljmssend(message) {     // null pointer exception     string queuename = message.getjmsdestination().tostring(); }  after(message message): calljmssend(message) {     // works     string queuename = message.getjmsdestination().tostring(); } 

reading javadoc getdestination() reveiled property set after send() called.

gets destination object message. jmsdestination header field contains destination message being >sent.

when message sent, field ignored. after completion of send or publish >method, field holds destination specified method.

is there other way can access jmsdestination within before advice?

edit: perhaps useful info: i'm using activemq

i've found solution problem:

messageproducer producer = (messageproducer)thisjoinpoint.gettarget(); string queuename = producer.getdestination().tostring(); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -