Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 55077 invoked from network); 27 Dec 2010 15:54:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Dec 2010 15:54:16 -0000 Received: (qmail 16265 invoked by uid 500); 27 Dec 2010 15:54:15 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 16093 invoked by uid 500); 27 Dec 2010 15:54:13 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 16085 invoked by uid 99); 27 Dec 2010 15:54:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Dec 2010 15:54:13 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of chubrilo@gmail.com designates 209.85.215.43 as permitted sender) Received: from [209.85.215.43] (HELO mail-ew0-f43.google.com) (209.85.215.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Dec 2010 15:54:09 +0000 Received: by ewy22 with SMTP id 22so4527053ewy.2 for ; Mon, 27 Dec 2010 07:53:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=B6dxTQLXX7MN7P5CEfLRo3BBeoUeYzp/0aig+J7xXdo=; b=GXHlsumITzkQllr9XG5gaBbaJZAq90u0Nu9X36NyfBZctZJJih9Hep1i8iGFuzWeib mR54epP60E/13f1km+MQI/07PkE990uB7mrq6HJZ/COpVA+ZluSxz5kdNw2mxtzoKkaF SBzHc4mTsSvS9s2e23sxa1mQhFb0qmKgvlaOI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=P/OfYhwd8+8YpHuf5AKOM4OEU4//huhzS3WYjjzo2LPNInErTvxG7qSAabxVPz7zy2 3pUyYGKMjJRfVlQX2Q2lsjN3y+6b0jhetmZcYRX2u1LAJ4Jc6G3Bx1Ew5lZr/i6Gl82P CppBbKcdFAqkCE5LUv5UHYySSmUnS3WAYPRHM= MIME-Version: 1.0 Received: by 10.213.14.148 with SMTP id g20mr9789283eba.43.1293465227745; Mon, 27 Dec 2010 07:53:47 -0800 (PST) Sender: chubrilo@gmail.com Received: by 10.213.26.13 with HTTP; Mon, 27 Dec 2010 07:53:47 -0800 (PST) In-Reply-To: References: Date: Mon, 27 Dec 2010 16:53:47 +0100 X-Google-Sender-Auth: Tl51BPbz9YhsAUwTFZ9-NPTvF_Q Message-ID: Subject: Re: Interceptor to get messages text From: Dejan Bosanac To: users@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: dejanb@fusesource.com Web: http://fusesource.com Twitter: =A0http://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 wrote: > > Two questions: > > what do you mean better ways??? > > Is there a way to intercept a message just before it is permanently store= d? I mean can i intercept messages just when the lock is aquired and are re= ady 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: dejan@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: dejanb@fusesource.com >> Web: http://fusesource.com >> Twitter: =E1http://twitter.com/dejanb >> ActiveMQ in Action - http://www.manning.com/snyder/ >> Blog - http://www.nighttale.net >> >> >> >> 2010/12/22 Petrucci Andreas : >> > >> > 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) >> > =E1 =E1throws Exception { >> > >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1/*System.out.println("Message := " + message.toString()); >> > >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1Configuration conf =3D new Conf= iguration(); >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 FileSystem fs =3D FileSystem.g= et(conf); >> > >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 Path filenamePath =3D new Path= ("hello.txt"); >> > >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 try { >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 FSDataOutputStream out =3D= fs.append(filenamePath); >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 System.out.println("Messag= e Length : " + message.toString().length()); >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 out.writeUTF(message.toStr= ing() ); >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 out.close();} >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 catch (IOException ioe) { >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 System.err.println= ("IOException during operation: " + ioe.toString()); >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 System.exit(1); >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 } >> > >> > =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1 =E1super.send(producer, message);*= / >> > =E1 =E1 =E1 =E1 =E1 =E1 } >> > >> > } >> > >> > >> > However what i do finally catch is at most an String of 806 characters= like this : >> > >> > Message : ActiveMQTextMessage {commandId =3D 5, responseRequired =3D f= alse, messageId =3D ID:dante-50013-1293033095353-0:1:1:1:1, originalDestina= tion =3D null, originalTransactionId =3D null, producerId =3D ID:dante-5001= 3-1293033095353-0:1:1:1, destination =3D queue://TEST.FOO, transactionId = =3D null, expiration =3D 0, timestamp =3D 1293033095707, arrival =3D 0, bro= kerInTime =3D 0, brokerOutTime =3D 0, correlationId =3D null, replyTo =3D n= ull, persistent =3D false, type =3D null, priority =3D 4, groupID =3D null,= groupSequence =3D 0, targetConsumerId =3D null, compressed =3D false, user= ID =3D null, content =3D null, marshalledProperties =3D null, dataStructure= =3D null, redeliveryCounter =3D 0, size =3D 0, properties =3D null, readOn= lyProperties =3D false, readOnlyBody =3D false, droppable =3D false, text = =3D M} >> > >> > What I really want to get is the text field, but if the message size e= xceeds a certain size then i cannot catch it? Any ideas? >> > >> > thanks, >> > Petrucci >> > >