camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: how do I transform a BSON into JSON using Camel message transformation pattern
Date Wed, 26 Nov 2014 06:30:17 GMT
Hi

You can write some java code that does that, or try a regular
expression to replace the ts part. You can then call the java code
from the Camel route to transform the message.



On Tue, Nov 25, 2014 at 8:51 PM, gmh <gordonwho@gmail.com> wrote:
>
> All,
> I am reading the oplog of Mongodb in my project in order to synch with
> redis.
> The BSON data I am capturing has the following format.
> {
>  "ts": Timestamp(1415124334, 1),
> "op": "i",
> "ns": "test.products",
> "o": {
> "_id": ObjectId("5459156e7950e8c18c094992"),
> "item": "card",
> "qty": 15
> }
> }
> The problem I am having is with the ts name:value pair.
> As the data indicates it is not a json so I can not marshall/unmarshall it.
> I do not care if the timestamp is there. So I want to know if there is a way
> I can transform this bson data by removing the ts name: value pair by using
> a Camel component? So the final data would look like this
> {
> "op": "i",
> "ns": "test.products",
> "o": {
> "_id": ObjectId("5459156e7950e8c18c094992"),
> "item": "card",
> "qty": 15
> }
> }
>
> and can be unmarshalled?
> Gordon
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-do-I-transform-a-BSON-into-JSON-using-Camel-message-transformation-pattern-tp5759598.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message