Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 53747 invoked from network); 19 Aug 2010 19:02:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Aug 2010 19:02:18 -0000 Received: (qmail 4761 invoked by uid 500); 19 Aug 2010 19:02:18 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 4721 invoked by uid 500); 19 Aug 2010 19:02:17 -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 4713 invoked by uid 99); 19 Aug 2010 19:02:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Aug 2010 19:02:17 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bruce.snyder@gmail.com designates 209.85.161.171 as permitted sender) Received: from [209.85.161.171] (HELO mail-gx0-f171.google.com) (209.85.161.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Aug 2010 19:02:13 +0000 Received: by gxk6 with SMTP id 6so1366539gxk.2 for ; Thu, 19 Aug 2010 12:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=xEZM3ODUsVNJ+5gEuOK5DvckRRGFCaXwW/4Tgbp7HRs=; b=F2pG5hlztO3GPQ6xraa2HmeZRtKNKHD+ekKV998Jo7JOp2SL0s7y+VmS2vQV1CxzlW MvZxQeulTxJgM4nMkTfYpkzCzT5pBNbU25cNpzAlCajuQQMu97BsNnrGY34QKd0lYYPG f6gPH7hmyYe1QUmng5PnGtwGrZlJRnfUI0av0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=qnDxU6N8DK3+QZJSxz3+9BvE/bkLzOC7QcYdToLKcyPvm24is2xNSfxqpBAef/27vN 8EsOi9fmm9S5cWhcXJfFPVewRvAGqyY1TAsMXLCvOk8jCv4/8WwVnMsdpAl2qj5o7t71 FLJz0wTibaqqxEe0EoOrXoZJaYLbBMTnx1Nc8= MIME-Version: 1.0 Received: by 10.151.128.7 with SMTP id f7mr336403ybn.313.1282244507762; Thu, 19 Aug 2010 12:01:47 -0700 (PDT) Received: by 10.231.149.130 with HTTP; Thu, 19 Aug 2010 12:01:47 -0700 (PDT) In-Reply-To: <29480597.post@talk.nabble.com> References: <29480597.post@talk.nabble.com> Date: Thu, 19 Aug 2010 13:01:47 -0600 Message-ID: Subject: Re: How to insert from Java a new JMSproperty in header? setStringProperty() does not work From: Bruce Snyder To: users@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Aug 19, 2010 at 4:46 AM, BenXS wrote: > > I am trying to set from a Java bean a new (additional) Property in header= . > Therefore I code (simplified) the following: > > > public void pass(Message mess) { > =A0 ... > =A0 mess.setPropertiesModifiable(true); > =A0 mess.setStringProperty("newprop", "value123"); > =A0 ...} > > But it didn't work. > > Compiler complains about cannot find symbol for "setPropertiesModifiable"= . > > If omit it the setPropertiesModifiable() statement then at runtime I get = an > exception > java.jms.MessageNotWriteableException: Message properties are read only > > So how do I resolve that? It looks like you are trying to modify a message that was just received. The problem with this is that messages are immutable once they have been sent by the producer. Also, the setPropertiesModifiable method is not from ActiveMQ, are you using a different vendor's JMS API? To work around this, just create a new message and copy anything from the existing message that you need. With a new message, you will be able to set properties without a problem. Bruce --=20 perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=3D6-E+G-N>61E