Re: Add header for each message

2010-08-31 Thread Willem Jiang

senthil.arumugam wrote:

Hi Willem,

Our use case is, we need to save or update the entity.

For eg,

We have a message of instance Foo and we need to decide whether the instance
to be saved or updated etc. This behavior is common across all the messages.

So we are wrapping Foo (actual message entity) with SampleMessageT which
has a generic property and a String property of type.

Based on the type, we will route the message body to actual bean to process
the same.

I meant by the term 'actual message', the entity which holds the body of the
Message. 


I would be interested to hear from you, how did your thought process go when
you got to think to replace proxy instance.


Oh, forget what I just said, I'm thinking your implementation is based 
on the proxy, but after thinking it twice the message body is 
BeanInvocation instance and it have nothing to do with your wrapping 
implementation.




Thanks,
- SK


Willem


Re: Error using inOut pattern

2010-08-31 Thread Willem Jiang

Hi,

Can you just insert a processor after the activemq:mm01.rin endpoint?
Maybe something is wrong with your internalViewer bean.

Willem

Muhammad Ichsan wrote:

Dear All

I have problem related to inOut in my attachment. The problem is that, 
Exchange.getIn().getBody() is null after inOut invocation. This problem 
doesn't occur if I do not have any to after activemq:mm01.rin


route
from uri=activemq:mm01.in http://mm01.in /
setExchangePattern pattern=InOut /
to uri=activemq:mm01.rin?replyTo=mm01.rout /
/route

route
from uri=activemq:mm01.rin /

!-- This to can cause problem
to uri=bean:internalViewer?method=view /
--
to uri=bean:interMessageController?method=toExternalMessage /
to uri=bean:communicator?method=write /
/route

route
from uri=bean:communicator?method=readNext /
to uri=bean:interMessageController?method=toInternalMessage /
to uri=activemq:mm01.rout /
/route

Thanks for your guidance.

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

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




Re: Error using inOut pattern

2010-08-31 Thread Muhammad Ichsan
On Tue, Aug 31, 2010 at 2:07 PM, Willem Jiang willem.ji...@gmail.comwrote:

 Hi,

 Can you just insert a processor after the activemq:mm01.rin endpoint?
 Maybe something is wrong with your internalViewer bean.


Thanks for your reply. Here I've just attached my complete code to make it
easier to analyze. This is strange.

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

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


Re: Error using inOut pattern

2010-08-31 Thread Willem Jiang

Muhammad Ichsan wrote:



On Tue, Aug 31, 2010 at 2:07 PM, Willem Jiang willem.ji...@gmail.com 
mailto:willem.ji...@gmail.com wrote:


Hi,

Can you just insert a processor after the activemq:mm01.rin endpoint?
Maybe something is wrong with your internalViewer bean.


Thanks for your reply. Here I've just attached my complete code to make 
it easier to analyze. This is strange.



I can't see any code from your mail.
Can you just past into the mail, I think the user mailing list doesn't 
support the attachment.


Willem


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

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




Re: Error using inOut pattern

2010-08-31 Thread Muhammad Ichsan
On Tue, Aug 31, 2010 at 2:32 PM, Willem Jiang willem.ji...@gmail.comwrote:

 Muhammad Ichsan wrote:


 Thanks for your reply. Here I've just attached my complete code to make it
 easier to analyze. This is strange.

  I can't see any code from your mail.
 Can you just past into the mail, I think the user mailing list doesn't
 support the attachment.


I tought so. So, please look at this:
http://filebin.ca/kvwcgp/research-inout.zip_

Thanks

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

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


Possibility of using inOut

2010-08-31 Thread Muhammad Ichsan
Dear All

I want to know if this is possible

route
from uri=direct:begining /
inOut uri=activemq:input?replyTo=output /
to uri=file:///tmp/result.txt /
/route

route
from uri=activemq:input /
to uri=bean:communicator?method=justSendNoWait /
/route

route
from uri=bean:communicator?method=readResponse /
to uri=activemq:output /
/route

How to implement communicator then?

Thanks

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

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


Re: Possibility of using inOut

2010-08-31 Thread Claus Ibsen
Read chapter 7 in the Camel book how to do request/reply over JMS.

The 2nd route (amq:input) will detect the JMSReplyTo header
automatic and automatic return back the reply. So you don't have to do
that manually.
Just at the end of the routing the message is send back to the
JMSReplyTo destination.


On Tue, Aug 31, 2010 at 12:59 PM, Muhammad Ichsan ich...@gmail.com wrote:
 Dear All

 I want to know if this is possible

 route
 from uri=direct:begining /
 inOut uri=activemq:input?replyTo=output /
 to uri=file:///tmp/result.txt /
 /route

 route
 from uri=activemq:input /
 to uri=bean:communicator?method=justSendNoWait /
 /route

 route
 from uri=bean:communicator?method=readResponse /
 to uri=activemq:output /
 /route

 How to implement communicator then?

 Thanks

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

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




-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: Possibility of using inOut

2010-08-31 Thread Willem Jiang

Muhammad Ichsan wrote:

Dear All

I want to know if this is possible

route
from uri=direct:begining /
inOut uri=activemq:input?replyTo=output /
to uri=file:///tmp/result.txt /
/route

route
from uri=activemq:input /
to uri=bean:communicator?method=justSendNoWait /
/route

route
from uri=bean:communicator?method=readResponse /
to uri=activemq:output /
/route

How to implement communicator then?

Thanks

As the from uri=bean;communicator?method=readResponse can't work for 
you, I think you can define the routes like this, the bean:communication 
need to make sure it sets a right correlationId message header.


route
   from uri=direct:begining /
   to uri=activemq:input?replyTo=output /
   to uri=file:///tmp/result.txt /
 /route

 route
   from uri=activemq:input /
   to uri=bean:communicator?method=sendRequestAndGetResponse /
   to uri=activemq:output /
 /route

Willem


Re: SMPP type connection.

2010-08-31 Thread Pavel Suhotyuk

We haven't time to analyze jsmpp library. We switch connection to
transmitter/receiver mode. Thank you.
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/SMPP-type-connection-tp2796517p2798133.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


SMPP data encoding.

2010-08-31 Thread Pavel Suhotyuk

Hello,

I have to send SMS with message body in UCS2 encoding. According to SMPP
spec v3.4, data_coding must contain b1000 UCS2 (ISO/IEC-10646) value.
I've set the encoding parameter in the connection string to UTF-16, but it
seems that camel-smpp plugin is always sending b0001 IA5 (CCITT
T.50)/ASCII (ANSI X3.4) value.

How i should properly configure camel-smpp plugin to resolve this problem? 

-- 
View this message in context: 
http://camel.465427.n5.nabble.com/SMPP-data-encoding-tp2798167p2798167.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: (newbie) process() method eating Exchange packet

2010-08-31 Thread Glen Mazza
Thanks, Willem, the link helped clarify things for me.  One more 
question: in Camel, what is the best way of determining of what type the 
body instance is, so I will know whether I need to use your suggestions 
of copying the message back into the body or use 
convertBodyTo(String.class)?  Is it as simple as checking if its 
instanceof(InputStream) or is there a more generic class I should use 
for that check?


You see, my SOAPMessagePreparer() below is currently identical to my 
SOAPResponseReader() (just outputs the line for debugging), but for the 
former, I don't have to convert the body into a string after reading it, 
presumably because from(jms:queue:numbersToDouble) already converts it 
to something that can be read multiple times. 


Glen

Willem Jiang wrote:

Glen Mazza wrote:

Thanks, Willem, but why would
String response = e.getIn().getBody(String.class);
consume the response?  Why does Camel delete the response when you 
call getBody()?

No, Camel didn't delete the response.
It's just because the body instance is an instance of InputStream, and 
it can't be read twice.

You can find more information about it here[1]


Also, for your second solution, why does converting the Body to a 
String result in the above call *not* consuming it anymore?  Camel 
seems highly arbitrary in the way it works.
Turn the message body into String could make the message body be 
reread-able.


[1]http://camel.apache.org/stream-caching.html

Willem



Thanks,
Glen

Willem Jiang wrote:

Hi Glen,

That's because your SOAPResponseReader consumer the response.
you just need to put the Body back as a string like this

public class SOAPResponseReader implements Processor {
   @Override
   public void process(Exchange e) {
  String response = e.getIn().getBody(String.class);
  System.out.println(This was returned - Body:  +
 response);
  e.getIn().setBody(response);
   }
 }

Or just turn the Body into String like this

from(jms:queue:numbersToDouble)
  .process(new SOAPMessagePreparer())
  .to(CXF_URI)
  .convertBodyTo(String.class)
  .process(new SOAPResponseReader())
  .to(file://testfile);


Willem

Glen Mazza wrote:
Hello, the following route makes SOAP client calls and places the 
SOAP responses in files in the given testfile folder:


  public void configure() {
 from(jms:queue:numbersToDouble)
 .process(new SOAPMessagePreparer())
 .to(CXF_URI)
//.process(new SOAPResponseReader())
 .to(file://testfile);
  }


Everything works fine.  But when I place a process method between 
the latter two to methods (i.e., uncomment the line above), the 
process method will read properly the SOAP response but it seems to 
eat it so that only blank files end up subsequently getting 
written to the testfile folder.


Here's my SOAPResponseReader:

public class SOAPResponseReader implements Processor {
  @Override
  public void process(Exchange e) {
 System.out.println(This was returned - Body:  + 
e.getIn().getBody(String.class));

  }
}

Any idea what's happening?  What do I need to do to 
SOAPResponseReader so that the final to(file://testfile) in the 
route will store the SOAP response in each file again?


Thanks,
Glen















Re: SMPP data encoding.

2010-08-31 Thread Christian Mueller

Hello Pavel!

I raised a JIRA for it: https://issues.apache.org/activemq/browse/CAMEL-3093

Cheers,
Christian
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/SMPP-data-encoding-tp2798167p2798585.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: SMPP data encoding.

2010-08-31 Thread Christian Mueller

Hello Pavel!

I committed a fix for this issue. Please feel free to try Camel 2.5-SNAPSHOT
whether this fix resolve your issue. It introduce a new option dataCoding
which should be set to 8 in your case.

Cheers,
Christian
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/SMPP-data-encoding-tp2798167p2798676.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Camel-QuickFIX jar issues

2010-08-31 Thread vcheruvu

Hi Hadrian,

Have you got any response for my second question?

Cheers,
-Vid-
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-QuickFIX-jar-issues-tp2652022p2798739.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Possibility of using inOut

2010-08-31 Thread Muhammad Ichsan
2010/8/31 Claus Ibsen claus.ib...@gmail.com

 Read chapter 7 in the Camel book how to do request/reply over JMS.

 The 2nd route (amq:input) will detect the JMSReplyTo header
 automatic and automatic return back the reply. So you don't have to do
 that manually.
 Just at the end of the routing the message is send back to the
 JMSReplyTo destination.


Sorry, I think you don't get it. The communicator is a socket bean which
maintain connection to remote host. A message sent to it can be a request
(which we can wait a response) and can be also a response.

When a response is coming in from bean:communicator?method=readResponse,
then I have to make the correlation id is the same with corresponding
request and it is sent back to amq:output. Else (when a request coming
from bean:communicator?method=readResponse), I just throw it to another
queue and do not care about correlation id.

The problem is I don't know exactly how to implement this communicator. This
is my snippet:

void justSendNoWait(Exchange x) {
   MyMessage m = x.getIn().getBody(MyMessage.class);
   if (m.isRequest()) {
   saveCorrelationId(m.getTraceNumber(),
x.getIn().getHeader(JMSCorrelationID));

   x.setPattern(ExchangePattern.InOnly); // I don't know if this is
necessary to make the message not delivered to it's caller, but instead wait
for future response
   }
}

void readResponse(Exchange x) {
  MyMessage m = x.getIn().getBody(MyMessage.class);
  if (m.isResponse()) {
  String cid = readCorrelationId(m.getTraceNumber());
  x.getOut().setHeader(JMSCorrelationID, cid);
  x.getOut().setBody(x.getIn().getBody());
  }
}

Is this correct? I have problem with this.

Thanks

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

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