activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: hacking 5.2.0 TopicSubsciption but can't get hold of the Session
Date Thu, 22 Oct 2009 18:19:45 GMT
have a look at
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java?view=markupfrom
trunk. It sends a message to the replyTo using internal broker apis.

2009/10/22 bravegag <bravegag@hotmail.com>

>
> 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 TopicSubscription.java 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,
> Giovanni
>  // 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);
>
>       replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>
>       TextMessage response = session.createTextMessage();
>       response.setText("DISCARDED");
>
>       replyProducer.send(response);
>       replyProducer.close();
> }
> }
>
> // after notifying then discard
> discard(oldMessage);
>
> --
> View this message in context:
> http://www.nabble.com/hacking-5.2.0-TopicSubsciption-but-can%27t-get-hold-of-the-Session-tp26013589p26013589.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message