java - How can I bridge HTTP and SMPP with Camel? -


the following code tries set camel route receive http posts , send them sms messages via smpp:

import org.apache.camel.camelcontext; import org.apache.camel.builder.routebuilder; import org.apache.camel.impl.defaultcamelcontext;  public class smsa {     public static void main(string[] args) throws exception {         camelcontext context = new defaultcamelcontext();         routebuilder builder = new routebuilder() {             @override             public void configure() throws exception {                 errorhandler(loggingerrorhandler());                  from("jetty:http://localhost:9993").                     setheader("camelsmppdestaddr", header("deliveryaddress")).                     to("smpp://smppclient1@localhost:2775?password=password&sourceaddr=1234")                 ;             }         };         builder.addroutestocamelcontext(context);         context.start();     } } 

this seems work @ first (sms sent), messages empty.

i use following command test:

curl -x post -d "hello world!" --header "content-type:text/plain" "http://localhost:9993?deliveryaddress=1818" 

if add custom processor , call

exchange.getin().getbody(string.class) 

(as per example on http://camel.apache.org/jetty.html), can see posted message.

i worked out myself - fix me change route to:

from("jetty:http://localhost:9993").     setheader("camelsmppdestaddr", header("deliveryaddress")).     setheader("camelsmppalphabet", constant(4)).     to("smpp://smppclient1@localhost:2775?password=password&sourceaddr=1234") ; 

looking @ code somewhere between camel 2.9.0 , 2.11.0 behaviour seems have changed expect byte[] default unless alphabet explicitly defined. since posted text/plain body didn't work.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -