Re: Intermittent error: No content to map due to end-of-input

2015-01-14 Thread Willem Jiang
When you convert the message into String, the message can be read more than 
once.
When you reset the stream cache, you can read the message again.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 14, 2015 at 10:21:47 AM, shanaloh (shana...@gmail.com) wrote:
> I read this thread and added convertBodyTo(String.class) after the wiretap
> and before unmarshal(). the error is gone.
>  
> http://t166678.apache-camel-user.apacheforum.info/wiretap-problem-t166678.html
>   
>  
> any idea why a convert to string will resolve the issue?
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Intermittent-error-No-content-to-map-due-to-end-of-input-tp5760725p5761661.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Re: Intermittent error: No content to map due to end-of-input

2015-01-13 Thread shanaloh
I read this thread and added convertBodyTo(String.class) after the wiretap
and before unmarshal(). the error is gone.

http://t166678.apache-camel-user.apacheforum.info/wiretap-problem-t166678.html

any idea why a convert to string will resolve the issue? 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Intermittent-error-No-content-to-map-due-to-end-of-input-tp5760725p5761661.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Intermittent error: No content to map due to end-of-input

2014-12-17 Thread shanaloh
Hi Willem, 

The only thing before the unmarshal is the wiretap. I am almost certain the
issue is with the wiretap. 

RouteDefinition rdRouteDefinition = from( createListeningService()
).routeId( getRouteId() ); 
*rdRouteDefinition.wireTap(ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute()
);* 
rdRouteDefinition.unmarshal().json(JsonLibrary.Jackson,
ExecutionRequest.class) 


* removed wiretap, i cannot re-produce the issue (tried 100 requests)
* added wiretap back, the error comes back intermittently 


I don't know why the wiretap should cause such issue tho. The Wiretap page
suggests the use of stream caching and we have adopted too. Any suggestions?

Thanks

Shan






--
View this message in context: 
http://camel.465427.n5.nabble.com/Intermittent-error-No-content-to-map-due-to-end-of-input-tp5760725p5760841.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Intermittent error: No content to map due to end-of-input

2014-12-16 Thread Willem Jiang
Did you try to reset the StreamCache before try to read something from it?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 16, 2014 at 3:04:45 PM, shanaloh (shana...@gmail.com) wrote:
> hi guys,
>  
> I am quite new to Camel. We are using Camel 2.14.
>  
> I got this intermittent error which is quite annoying. It happens very
> rarely and randomly. If I send the same request again, it will process just
> fine.
>  
> 2014-12-15 17:24:56.700 ERROR 1852673485@qtp-1010937526-2
> common.exception.MTSErrorHandler Received Exception
> com.fasterxml.jackson.databind.JsonMappingException: No content to map due
> to end-of-input
> at Source: org.apache.camel.converter.stream.InputStreamCache@64288413;
> line: 1, column: 1
>  
> After searching this exception, I have seen many places where people suggest
> to use stream caching. However in our case, stream caching is already used.
> I am not sure however if it is set up properly.
>  
> Thanks in advance for any your inputs.
>  
> Cheers
>  
> Shan
>  
> *This is our camel context config*
>  
> > trace="${camel.trace:false}" streamCache="true">
>  
> When project starts up, this line indicates it is enabled:
> 2014-12-16 16:13:04.300 INFO [main] [camel.spring.SpringCamelContext]
> StreamCaching is enabled on CamelContext: camelContext
>  
>  
>  
> *This is our code.*
>  
>  
> RouteDefinition rdRouteDefinition = from( createListeningService()
> ).routeId( getRouteId() );
> rdRouteDefinition.wireTap(
> ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute() );
> rdRouteDefinition
> .process(new Processor() {
>  
> @Override
> public void process(Exchange exchange) throws Exception {
> _log.info("Before unmarshall()" );
> _log.info("exchange body = " + exchange.getIn().getBody());
> _log.info("exchange body size = " +
> exchange.getIn().getBody(InputStreamCache.class).length());
> }
>  
> })
> .unmarshal().json(JsonLibrary.Jackson, ExecutionRequest.class)
> .to(ABCRouteType.VALIDATOR.getRoutePrefix() + requestXsd)
> .convertBodyTo(FIXExecutionReport.class)
> .process(fixMessageProcessor)
> .wireTap( ABCRouteType.LOG.getRoutePrefix() + _log.getName() +
> ABCGenericConstants.LOGGING_ROUTE_OPTIONS )
> .inOnly( routeType.getRoutePrefix() + publishingDestination );
>  
> rdRouteDefinition.wireTap(
> ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute() );
>  
>  
>  
> *This is the logging *
>  
> 2014-12-15 17:24:56.682 INFO 1852673485@qtp-1010937526-2 Before
> unmarshall()
> 2014-12-15 17:24:56.682 INFO 1852673485@qtp-1010937526-2 exchange body =
> org.apache.camel.converter.stream.InputStreamCache@64288413
> 2014-12-15 17:24:56.683 INFO 1852673485@qtp-1010937526-2 exchange body size
> = 646
>  
> 2014-12-15 17:24:56.700 ERROR 1852673485@qtp-1010937526-2
> common.exception.ABCErrorHandler Received Exception
> com.fasterxml.jackson.databind.JsonMappingException: No content to map due
> to end-of-input
> at Source: org.apache.camel.converter.stream.InputStreamCache@64288413;
> line: 1, column: 1
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Intermittent-error-No-content-to-map-due-to-end-of-input-tp5760725.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Intermittent error: No content to map due to end-of-input

2014-12-15 Thread shanaloh
hi guys,

I am quite new to Camel. We are using Camel 2.14.

I got this intermittent error which is quite annoying. It happens very
rarely and randomly. If I send the same request again, it will process just
fine.

2014-12-15 17:24:56.700 ERROR 1852673485@qtp-1010937526-2
common.exception.MTSErrorHandler Received Exception
com.fasterxml.jackson.databind.JsonMappingException: No content to map due
to end-of-input
at Source: org.apache.camel.converter.stream.InputStreamCache@64288413;
line: 1, column: 1

After searching this exception, I have seen many places where people suggest
to use stream caching. However in our case, stream caching is already used.
I am not sure however if it is set up properly.

Thanks in advance for any your inputs.

Cheers

Shan

*This is our camel context config*



When project starts up, this line indicates it is enabled:
2014-12-16 16:13:04.300 INFO  [main] [camel.spring.SpringCamelContext]
StreamCaching is enabled on CamelContext: camelContext



*This is our code.*


RouteDefinition rdRouteDefinition = from( 
createListeningService()
).routeId( getRouteId() );
rdRouteDefinition.wireTap(
ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute() );
rdRouteDefinition
.process(new Processor() {

@Override
public void process(Exchange exchange) throws Exception 
{
_log.info("Before unmarshall()" );
_log.info("exchange body = " + 
exchange.getIn().getBody());
_log.info("exchange body size = " +
exchange.getIn().getBody(InputStreamCache.class).length());
}

})
.unmarshal().json(JsonLibrary.Jackson, ExecutionRequest.class)
.to(ABCRouteType.VALIDATOR.getRoutePrefix() + requestXsd)
.convertBodyTo(FIXExecutionReport.class)
.process(fixMessageProcessor)
.wireTap( ABCRouteType.LOG.getRoutePrefix() + _log.getName() +
ABCGenericConstants.LOGGING_ROUTE_OPTIONS )
.inOnly( routeType.getRoutePrefix() + publishingDestination );

rdRouteDefinition.wireTap(
ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute() );



*This is the logging *

2014-12-15 17:24:56.682 INFO 1852673485@qtp-1010937526-2  Before
unmarshall()
2014-12-15 17:24:56.682 INFO 1852673485@qtp-1010937526-2  exchange body =
org.apache.camel.converter.stream.InputStreamCache@64288413
2014-12-15 17:24:56.683 INFO 1852673485@qtp-1010937526-2  exchange body size
= 646

2014-12-15 17:24:56.700 ERROR 1852673485@qtp-1010937526-2
common.exception.ABCErrorHandler Received Exception
com.fasterxml.jackson.databind.JsonMappingException: No content to map due
to end-of-input
at Source: org.apache.camel.converter.stream.InputStreamCache@64288413;
line: 1, column: 1



--
View this message in context: 
http://camel.465427.n5.nabble.com/Intermittent-error-No-content-to-map-due-to-end-of-input-tp5760725.html
Sent from the Camel - Users mailing list archive at Nabble.com.