camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramrubio <>
Subject stream caching to HTTP end point
Date Thu, 01 Aug 2013 01:25:17 GMT
Attempting to implement a proxy service to route requests dynamically using
DynamicRouter pattern suggested by 

I'm unsuccessful though in getting streamcaching to work.  I've enabled
streamcaching on the CamelContext but when the proxysvc forwards the POST
request to my endpoint the body is always empty. 

<camelContext id="camel" streamCache="true"
    <routeBuilder ref="CamelRouteBeanId"/>

Below is my code that perform the slip functionality.

public void configure() throws Exception {

    	Processor processor = new MyProcessor();
    		.dynamicRouter(method(CamelRoute.class, "slip"));

public static String slip(String body_p, @Properties Map<String, Object>
    		@Headers Map<String, Object>headersMap_p) {
    	String serviceEndPoint = null;
    	String publicUri = (String)headersMap_p.get(Exchange.HTTP_URI);
    	//byte []bodyByteArray = body_p.getBytes();
    	if(publicUri != null)
	    	// get the state from the exchange properties and keep track how many
	        // we have been invoked
	        int invoked = 0;
	        Object current = propertiesMap_p.get("invoked");
	        if (current != null) {
	            invoked = Integer.valueOf(current.toString());
	        // and store the state back on the properties
	        propertiesMap_p.put("invoked", invoked);
	        if(invoked == 1)
	        	serviceEndPoint = CamelRoute.constructUri();
        return serviceEndPoint;        
    private static String constructUri()
    	String serviceEndPoint = null;    	    	 
    	String server = "http://localhost:8080";
    	serviceEndPoint = server 
    	return serviceEndPoint;

The Request is forwarded to my http end point but the body is always empty.

Can someone provide information as to whether streamCache works for http end
point?  If i add a processor to route that sets body as string in request
this code works but this work around loads the entire body to memory which
causes issues for large requests.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message