Hi

See this page how to use java routes in xml , section = using java
code (same style for blueprint as for spring)
http://camel.apache.org/spring




On Fri, Jan 17, 2014 at 10:25 AM, Muhzin <rmuh...@gmail.com> wrote:
> Thanks for the reply. I'm trying to convert my camel configuration from
> java DSL to blueprint and come across some hurdles.
>
> My route config looks something like
> SimpleRegistry registry = new SimpleRegistry();
> registry.put("sqsClient", sqsClient);
>
> CamelContext context = new DefaultCamelContext(registry);
> context.addRoutes(new RouteBuilder() {
>     @Override
>     public void configure() throws Exception {
>         from("aws-sqs://
> sqs.ap-southeast-2.amazonaws.com/122343553/profile-data?amazonSQSClient=#sqsClient
> ")
>                 .process(new Processor() {
>                     @Override
>                     public void process(Exchange exchange) throws Exception
> {
>
>                         String rawMessage =
> exchange.getIn().getBody(String.class);
>                         Gson gson = new GsonBuilder().create();
>                         Message message = gson.fromJson(rawMessage,
> Message.class);
>                         DynamoDBStorage dynamoStorage = new
> DynamoDBStorage(dynamoDBClient);
>
>                         if (message.getAction().equals("createProfile")) {
>                             User user =
> dynamoStorage.getUserDetails(message.getId());
>                             MysqlStorage mysqlStorage = new MysqlStorage();
>                             mysqlStorage.insertNewUser(user);
>                         } else {
>                             System.out.println(message.getAction());
>                         }
>                     }
>                 });
>     }
> });
>
>
> When converting it into blueprint,
> #) How can I create a custom processor like above?
> #) How can I get my objects like sqsClient to blueprint?
> #) How can I make objects like 'gson'  shown above in my route?
> #) How can I make the routing like if else shown above?
>
>
> Is there some detailed tutorial on how to write camel-blueprint? The one i
> could find was 
> http://camel.apache.org/using-osgi-blueprint-with-camel.htmlwhich
> only cover the basics.
>
>
> On Fri, Jan 17, 2014 at 1:10 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>
>> Hi
>>
>> Using a spring or blueprint xml file to bootstrap Camel is often much
>> easier, as it does all the OSGi lifecycle and other pieces you
>> otherwise must do yourself.
>>
>> If you dont want to do that, then you need to use an osgi activator to
>> call some code, that creates a OsgiCamelContext and setup a bunch of
>> stuff to make it run in OSGi. And as well stop and cleanup these
>> services again when the bundle stops.
>>
>> Though much easier to just have a little
>> OSGI-INF/blueprint/somenamehere.xml blueprint xml file that embeds a
>> <camelContext> and you have Camel running.
>>
>>
>>
>> On Fri, Jan 17, 2014 at 4:48 AM, Muhzin <rmuh...@gmail.com> wrote:
>> > Hi all,
>> > I am trying to run camel application in karaf. I new to programming for
>> > osgi. How can I make my camel routes run in it? Can i put it in a normal
>> > main() class and run it?
>> >
>> > --
>> > BR
>> > Muhsin
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cib...@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>> Make your Camel applications look hawt, try: http://hawt.io
>>
>
>
>
> --
> BR
> Muhsin



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to