if you use JMS than your data will be send as ObjectMessage which makes use of JAVA object serialization thus it's converted to byte stream at some point in time. But this serialization only occurs ones when ActiveMQ sends your message to JMS listeners (regardless if same VM or another one). If you want to avoid the "heavy" default java object serialization you can try using a TextMessage and XML/JSON/Protobuffer whatever, but I wonder if performance is really a problem? An object makes handling of your business logic in all your camel processors far easier (a map, a business related class) in contrast to repeatingly parse XML again and again (in case your logic is spread accross multiple processors). If you create an instance ones and just send it immediately by JMS simply go for java's default serialization and you are done without writing any additional code until performance really matters

Jens


Am 30.04.14 10:06, schrieb Muhammad Ichsan:
Ah..!

So, in the same JVM, using Java object simply uses an instance
pointer. But if I'm going to produce into an ActiveMQ endpoint, I
should make sure the MQ in the same JVM with vm transport or, I should
marshall into protobuf bytes. The MQ is used for my own system too,
but different physical location.


On Wed, Apr 30, 2014 at 3:49 PM, [email protected]
<[email protected]> wrote:
What do you mean by different systems? Different Camel Processors?

You can store your data as body/property and this is a pure instance pointer. 
As long the message is not deep cloned/serialized as bytestream there is no 
overhead passing this message through the camel routes (in one vm).

Can you provide more info maybe I simply did not get it?

Jens

Von meinem iPhone gesendet

Am 30.04.2014 um 08:34 schrieb Muhammad Ichsan <[email protected]>:

Hi

I'm thinking about creating a common message which will hold all data
during all business invocations across different system in Camel (of
course with translation for vary systems).

In my first thought, I'm going to use a simple one like Map. The the
payload is simple to use in processor. I can use

public Map setFee(Map<String, String> commonMessage) {
  // Modif

  return commonMessage;
}

But sending Map along the way of transaction process means that there
will be conversion of java.util.Map into bytes over and over again.

My second thought is, using XML or JSON text. But I face more complex
processing in the processor

public String setFee(String commonMessage) {
  Map<String, String> map = helper.toMap(commonMessage);

  // Modif

  return helper.toString(map);
}

So, which one is the most efficient way?

--
~The best men are men who benefit to others
http://www.michsan.web.id 一緒に勉強しましょう!

Yang berkualitas memang beda rasanya!
http://rizqi-cookies.com



Reply via email to