camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmh <gordon...@gmail.com>
Subject how to process json and dispatch to several processors
Date Mon, 10 Nov 2014 15:43:02 GMT
All,
I have a simple use case I am trying to implement.
We will be receiving data from websocket.
I am thinking about using poll consumer pattern to test for now.
Essentially I will have the following json coming thru the activemq queue. 

{name: abc
  address: xyz
}

Where the json does not really matter but how I dispatch the data to
different components is what I am looking for.
I need to be able to rout the json data to different components. I am
thinking about using jsonpath.

Something like this?

from("direct:type")
                      .choice()
                     
.when(PredicateBuilder.isEqualTo(ExpressionBuilder.languageExpression("jsonpath",
"$.kind"), ExpressionBuilder.constantExpression("full")))
                        .to("mock:full")
                        .otherwise()
                        .to("mock:empty");
            }

But the components will be the same just need t send the value of name
(example above) to some component that will do the processing (calling the
db  to do some querying)
So essentially this is the work flow.

Receive a json
Read the json and dispatch the value of the json to some processor to do
some type of querying against the database (find name in db) .  Do this for
each json name:value pair (json wil not change, will always have the same
name:value pairs)  Combine the result for each name:value pair.

Any pointers/ideas as how to implement this type of processing? What kind of
patterns should I implement? Any simple code snippets to illustrate the
points.
I am also thinking about leveraging Akka for this pattern as well since we
have potentially many millions of records and will need to ensure the
processing is done per json and concurrency is guaranteed.
Thanks,
Gordon



--
View this message in context: http://camel.465427.n5.nabble.com/how-to-process-json-and-dispatch-to-several-processors-tp5758838.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message