Hi Donald, It is already an Integer object and should be getting autoboxed anyway on ++, otherwise the code wouldn't compile in the first place, unless of course the semantics of prepending the ++ operator on a boxed primitive are acting a bit weird..
On 25 February 2011 15:16, Donald Whytock <dwhyt...@gmail.com> wrote: > Exchange.setProperty() expects an Object. Perhaps box your > retry_count in an Integer? > > On Fri, Feb 25, 2011 at 3:43 AM, Yiannis Mavroukakis > <imavrouka...@gameaccountnetwork.com> wrote: > > Hello, > > > > I'm trying to add some ancillary information to an Exchange getting > picked > > up from a dead message queue for retries. I'm > > basically trying to add a retry count so after a certain amount of > pickups > > from the dead queue the message is forwarded to > > a final queue and remains there for manual inspection. This is the code > that > > I have that does this > > > > @RoutingSlip > > > > public final String[ ] routeEvent( final Exchange exchange , final > Event > > event ) > > > > { > > > > final Exception cause = exchange.getProperty( Exchange. > > EXCEPTION_CAUGHT , Exception.class ); > > > > final Date createdDate = exchange.getProperty( Exchange. > > CREATED_TIMESTAMP , Date.class ); > > > > Integer retryCount = exchange.getProperty( TOTAL_RETRIES , > Integer. > > class ); > > > > final String[ ] route; > > > > if( retryCount == null ) > > > > { > > > > retryCount = 0; > > > > > > } > > > > > > if( retryCount > MAX_TOTAL_RETRIES ) > > > > { > > > > LOG.info( "Max retry count of {} reached for message {} > > discarding" , retryCount , exchange.getExchangeId( ) ); > > > > route = reallyDead; > > > > } > > > > else > > > > { > > > > exchange.setProperty( TOTAL_RETRIES , ++retryCount ); > > > > LOG.info( "Retrying dead message, message created {}, > exception > > " , createdDate , cause ); > > > > LOG.info( "{} retries left for message id {} " , > > MAX_TOTAL_RETRIES - retryCount , exchange.getIn( ) > > > > .getMessageId( ) ); > > > > route = super.routeEvent( event ); > > > > } > > > > return route; > > > > } > > > > > > While testing, the retryCount is always 0, which implies that the > Exchange > > modified is a copy and not the one I modified in the first > > pass of a failed message. I guess my question is, am I trying to do > > something that there's already some DSL, or am I simply using the > Exchange > > the wrong way, and I have to pass it on somehow? > > > > Thank you, > > > > Ioannis > > >