I didn't realize that you want to intercept messages before they are
added to the broker. In case you just want to "log" all the messages
that comes to the destination, you can use Camel to easily do that.
For queues, you can use "mirrored queues"
http://activemq.apache.org/mirrored-queues.html


Cheers
--
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: dej...@fusesource.com
Web: http://fusesource.com
Twitter:  http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Mon, Dec 27, 2010 at 1:22 PM, Petrucci Andreas
<petrucci_2...@hotmail.com> wrote:
>
> Two questions:
>
> what do you mean better ways???
>
> Is there a way to intercept a message just before it is permanently stored? I 
> mean can i intercept messages just when the lock is aquired and are ready to 
> permanently stored in amq or kahadb??
>
> thnx,
> Petrucci
>
>> Date: Wed, 22 Dec 2010 17:30:46 +0100
>> Subject: Re: Interceptor to get messages text
>> From: de...@nighttale.net
>> To: users@activemq.apache.org
>>
>> Hi,
>>
>> try
>>
>> ((TextMessage)message).getText()
>>
>> but there are better ways to achieve what your code is doing here.
>>
>> Cheers
>> --
>> Dejan Bosanac
>> -----------------
>> FuseSource - The experts in open source integration and messaging.
>> Email: dej...@fusesource.com
>> Web: http://fusesource.com
>> Twitter: áhttp://twitter.com/dejanb
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>>
>>
>> 2010/12/22 Petrucci Andreas <petrucci_2...@hotmail.com>:
>> >
>> > Hi there, i have constructed an interceptor in order to get producers 
>> > messages. the code is below.
>> >
>> > public class mypluginBroker extends BrokerFilter {
>> >
>> > public void send(ProducerBrokerExchange producer, Message message)
>> > á áthrows Exception {
>> >
>> > á á á á á á á á á á/*System.out.println("Message : " + message.toString());
>> >
>> > á á á á á á á á á áConfiguration conf = new Configuration();
>> > á á á á á á á á á á FileSystem fs = FileSystem.get(conf);
>> >
>> > á á á á á á á á á á Path filenamePath = new Path("hello.txt");
>> >
>> > á á á á á á á á á á try {
>> > á á á á á á á á á á á FSDataOutputStream out = fs.append(filenamePath);
>> > á á á á á á á á á á á System.out.println("Message Length : " + 
>> > message.toString().length());
>> > á á á á á á á á á á á out.writeUTF(message.toString() );
>> > á á á á á á á á á á á out.close();}
>> > á á á á á á á á á á á catch (IOException ioe) {
>> > á á á á á á á á á á á á á System.err.println("IOException during 
>> > operation: " + ioe.toString());
>> > á á á á á á á á á á á á á System.exit(1);
>> > á á á á á á á á á á á á }
>> >
>> > á á á á á á á á á ásuper.send(producer, message);*/
>> > á á á á á á }
>> >
>> > }
>> >
>> >
>> > However what i do finally catch is at most an String of 806 characters 
>> > like this :
>> >
>> > Message : ActiveMQTextMessage {commandId = 5, responseRequired = false, 
>> > messageId = ID:dante-50013-1293033095353-0:1:1:1:1, originalDestination = 
>> > null, originalTransactionId = null, producerId = 
>> > ID:dante-50013-1293033095353-0:1:1:1, destination = queue://TEST.FOO, 
>> > transactionId = null, expiration = 0, timestamp = 1293033095707, arrival = 
>> > 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = 
>> > null, persistent = false, type = null, priority = 4, groupID = null, 
>> > groupSequence = 0, targetConsumerId = null, compressed = false, userID = 
>> > null, content = null, marshalledProperties = null, dataStructure = null, 
>> > redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = 
>> > false, readOnlyBody = false, droppable = false, text = M}
>> >
>> > What I really want to get is the text field, but if the message size 
>> > exceeds a certain size then i cannot catch it? Any ideas?
>> >
>> > thanks,
>> > Petrucci
>> >
>

Reply via email to