Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8FD0A10A9C for ; Fri, 17 Jan 2014 09:25:39 +0000 (UTC) Received: (qmail 44500 invoked by uid 500); 17 Jan 2014 09:25:38 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 43796 invoked by uid 500); 17 Jan 2014 09:25:36 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 43786 invoked by uid 99); 17 Jan 2014 09:25:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 09:25:36 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rmuhzin@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vb0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 09:25:31 +0000 Received: by mail-vb0-f48.google.com with SMTP id q16so1412483vbe.7 for ; Fri, 17 Jan 2014 01:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=AyFgkkoxAjRQvMJPTt4e5RnAE4ISkndbZ1c3f+9KLxM=; b=ZQn1CKe9kKL13dGrik6NucZiBYxOIUJiynODi4xU/1qUCCEuYh/KHdFxnuK9wUpK2z LuI1cL0mg4yWba6emswXrO0Lp+DZxLb2pFP8BAxIqhi2Cne71v17yzakwV7rFhR0K8Ux L8jj7hF1thRtqJNc68NUeVmoZZxDYh8hplpTHpdJPPcjh2H686S7hWVJeZHpXgflk3Ia wvKYL7du/171XXXxOKYE8lKQLUnLkoR7TnRegi+9cGKj0yIVHDz+6rshWP66G98s/PIT 0iAm1rp1UbSTvubaruOdcYsEhisKkDZnApfyJDgmxCEcW1CpGouTQyjt+KOCTTInAXhb 45lg== MIME-Version: 1.0 X-Received: by 10.221.26.10 with SMTP id rk10mr419981vcb.0.1389950710341; Fri, 17 Jan 2014 01:25:10 -0800 (PST) Received: by 10.58.235.39 with HTTP; Fri, 17 Jan 2014 01:25:10 -0800 (PST) In-Reply-To: References: Date: Fri, 17 Jan 2014 14:55:10 +0530 Message-ID: Subject: Re: Camel main class in osgi bundle From: Muhzin To: users@camel.apache.org Content-Type: multipart/alternative; boundary=001a11339ae45863b704f0271e90 X-Virus-Checked: Checked by ClamAV on apache.org --001a11339ae45863b704f0271e90 Content-Type: text/plain; charset=ISO-8859-1 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 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 > and you have Camel running. > > > > On Fri, Jan 17, 2014 at 4:48 AM, Muhzin 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: cibsen@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 --001a11339ae45863b704f0271e90--