activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bravegag <>
Subject hacking 5.2.0 TopicSubsciption but can't get hold of the Session
Date Thu, 22 Oct 2009 17:00:22 GMT

hi all,

I was previously asking how to extend the constant message pending limit
strategy to  send a custom "discarded" message to the replyTo field of the
old message before discarding it so a blocked sender can be released. This
architecture in general does not make much sense on top of JMS ... blocking
etc but this is a school benchmarking assignment ...

The code below is copied from 5.2 line #116 I am
hacking to support such notify "discarded feature".

The only problem I have is that I don't know where to get the session from
to generate such reply "discarded" message ... any ideas? have been browsing
all the members etc but no clue where to get it from ...

Thanks in advance,
Best regards,
 // hack hack hack hack
 // hack hack hack hack
 // hack hack hack hack	                                
 if (oldMessage instanceof TextMessage) {
    TextMessage textMessage = (TextMessage) oldMessage;
    Destination destination = (Destination) textMessage.getJMSReplyTo();
    if (destination != null) {
       // Setup a message producer to respond to messages from clients, we
will get the destination
       // to send to from the JMSReplyTo header field from a Message
       MessageProducer replyProducer = session.createProducer(null);
       TextMessage response = session.createTextMessage();  
// after notifying then discard

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message