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 987AA10E99 for ; Mon, 16 Dec 2013 22:01:45 +0000 (UTC) Received: (qmail 99159 invoked by uid 500); 16 Dec 2013 22:01:45 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 99120 invoked by uid 500); 16 Dec 2013 22:01:45 -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 99112 invoked by uid 99); 16 Dec 2013 22:01:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Dec 2013 22:01:45 +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 kraythe@gmail.com designates 209.85.220.171 as permitted sender) Received: from [209.85.220.171] (HELO mail-vc0-f171.google.com) (209.85.220.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Dec 2013 22:01:39 +0000 Received: by mail-vc0-f171.google.com with SMTP id ik5so3575555vcb.2 for ; Mon, 16 Dec 2013 14:01:18 -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=iL10YP8SQ5ub+VFbFYa/1oy4nazrGrEGpxCQoOCG4gE=; b=1JKMt4IVL+QC8/8UqJqmEzPTkPYtfcVrRn77f7LqmOzuzUp2s/QjFtBi8H/8KDd6rL ypid/0HeKq8NQRyyT3KqcG64VXxEGluG8wwrqWvPCchaRQcn77mSehhdkXTAjojMCVuG VoMQGhKuwJG2ptY+a2FiqlvIxOpAiht2yOVpOkJMCDSUAGG1hTu8rsZD7U8pJAp91Thx 284TL24J81i9j6ohuvbEnLd7NS2P4p8/UUS4d2GMdobAntLJ8yKcmZNsHgRbEO1+WgWP qMI2HjLVsF1HfNydEOFHR6++r4x4DRIY+qtoNsAfiE4HKpqoIbXs5+8Un1XqMjrhmpcD Vwyg== MIME-Version: 1.0 X-Received: by 10.52.26.77 with SMTP id j13mr4115514vdg.33.1387231278580; Mon, 16 Dec 2013 14:01:18 -0800 (PST) Received: by 10.58.172.34 with HTTP; Mon, 16 Dec 2013 14:01:18 -0800 (PST) In-Reply-To: References: <3CCCD9AF5E124D4496F5F50E7CD2168911E52AA9@DEWDFEMB19C.global.corp.sap> <005b01cef5ce$10000d30$30002790$@de> <3CCCD9AF5E124D4496F5F50E7CD2168911E53876@DEWDFEMB19C.global.corp.sap> Date: Mon, 16 Dec 2013 16:01:18 -0600 Message-ID: Subject: Re: Why Pass Java object in Twitter (& other) component From: "kraythe ." To: Camel Users List Content-Type: multipart/alternative; boundary=20cf307d045a94cc1904edadf3e3 X-Virus-Checked: Checked by ClamAV on apache.org --20cf307d045a94cc1904edadf3e3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The only real reason not to put an object of type X in an exchange is the need to convert in and out of the type. I dont think POJO mapping all json is a useful thing but there are many canonical data formats that can accomplish the same thing (such as a map). The only thing you have to keep in mind is when communicating with ActiveMQ you will have to make sure your object is in a standard format that JMS can handle. Although you can pass object messages, I strongly encourage the use of JSON for debuggability. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 * On Mon, Dec 16, 2013 at 1:14 PM, Bruno Borges wrote= : > Hi, > > The reason to keep twitter4j.Status as the payload is to avoid conversion= s > on every project. In my experience, to read JSON data inside a Java > application, developers tend to convert to a POJO-like object. So if this > would be the common case, why not use the twitter4j.Status object? I'd sa= y > this is the right way. If one wants to convert to JSON, then a > TypeConverter is possible. > > For GeoLocation, please check this method: > http://twitter4j.org/javadoc/twitter4j/Status.html#getGeoLocation() > > If this method is not in the current version of the Twitter component, > please submit a JIRA ticket to upgrade Twitter4J version. > > PS: I'm one of the authors of the Twitter component > > Best regards > > *Bruno Borges* > (11) 99564-9058 > *www.brunoborges.com * > > > On Wed, Dec 11, 2013 at 1:59 AM, Goyal, Arpit wrote= : > > > Hi Jan, > > > > Thanks for the explanation. So if I am writing camel component, I can u= se > > any library to return any object instead of standard XML / JSON / CSV > > format. Or if the external system returns in XML / JSON, pass on the da= ta > > as it is in the 'Exchange' object. The question only comes because I > wanted > > to understand here the general trend before I go ahead and write the ne= w > > camel component. > > > > >>> For further conversion you could use the typeconverters. > > > > The typeconvertors of Twitter returns only partial information of Statu= s > > object. Doesn't pass on the Geo location for example. > > > > Regards, > > Arpit. > > > > -----Original Message----- > > From: Jan Mat=E8rne (jhm) [mailto:apache@materne.de] > > Sent: Tuesday, December 10, 2013 11:04 PM > > To: users@camel.apache.org > > Subject: AW: Why Pass Java object in Twitter (& other) component > > > > > > Why not have standard behavior across camel components? > > > > > > Each component provides messages in the most > > > efficient/generic/convenient way it is possible in given context. > > > > > > What kind of standard message format are you thinking of? JSON for > > > example? > > > > A "common" format could only be some such generic as typeless XML or > JSON. > > Otherwise you would find use cases where some flag, some information, > some > > format is missed. > > The "common format" Camel uses for routing is "exchange" with its > > properties > > and in and out messages with headers. > > > > A Camel component has to deal with exactly one external system. So the > > format used there could be focused to that external system (http header= , > > ssl > > credentials, ftp password, pgp encryption, jdbc datasource name...). Th= e > > components job is to transform that data to "exchange". > > > > For further conversion you could use the typeconverters. > > > > (I hope to be right ;) > > > > > > Jan > > > > > --20cf307d045a94cc1904edadf3e3--