You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by xiangqiuzhao <xi...@gmail.com> on 2011/07/28 12:16:52 UTC

how to route once from(myComponent://).to(cxf://) ?

my application need to send message to the other application by webservices.

so i need to execute the message route by hand. how to send once and
received the response than finished?

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642015.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by xiangqiuzhao <xi...@gmail.com>.
i look at the camel-core testcase, i need to call myself like this:

Endpoint endpoint = context.getEndpoint("direct:myplatform");
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader("cheese", 123);
exchange.getIn().setBody("abcdeffdsaljfla".getBytes());

Producer producer = endpoint.createProducer();
producer.process(exchange);

but only this way?

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642481.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by Willem Jiang <wi...@gmail.com>.
ProducerTemplate and ConsumerTemplate are leverage the endpoint to 
create the producer and consumer.
I think you should take some time to read the Camel in Action and the 
camel direct component code. I cannot get your other question.

On 7/28/11 9:12 PM, xiangqiuzhao wrote:
> what's the difference between use endpoint to create producer with use
> template?  or when should to use template? only the difference with the code
> lines count?
>
> other question:
>
> Producer producer = endpoint.createProducer();
>          producer.process(exchange);
>
> why i use from("direct:name").to() i need to createProducer ? not
> createConsumer?
> not from=Consumer, to=Producer??
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642571.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by xiangqiuzhao <xi...@gmail.com>.
what's the difference between use endpoint to create producer with use
template?  or when should to use template? only the difference with the code
lines count?

other question:

Producer producer = endpoint.createProducer();
        producer.process(exchange);

why i use from("direct:name").to() i need to createProducer ? not
createConsumer?
not from=Consumer, to=Producer??

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642571.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 28, 2011 at 2:35 PM, xiangqiuzhao <xi...@gmail.com> wrote:
>
> Camel In Action 7.7.1 wrote:
>>
>> The Direct component lets you make a synchronous
>> call to a route or, conversely, expose a route as a synchronous service.
>>  To demonstrate, say you have a route that’s exposed by a direct endpoint
>> as follows:
>> from("direct:startOrder")
>>   .to("cxf:bean:orderEndpoint");
>> *Sending  a  message  to  the  direct:startOrder  endpoint*  will  invoke
>> a  web  service
>> defined by the orderEndpoint CXF endpoint bean
>>
>
> my problem is how to sending a message to the direct:startOrder endpoint and
> it will be send to CXF endpoint by camel?
>

You can use a ProducerTemplate.
http://camel.apache.org/producertemplate.html

As well as appendix C in the Camel book



>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642434.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by xiangqiuzhao <xi...@gmail.com>.
Camel In Action 7.7.1 wrote:
> 
> The Direct component lets you make a synchronous 
> call to a route or, conversely, expose a route as a synchronous service. 
>  To demonstrate, say you have a route that’s exposed by a direct endpoint
> as follows:
> from("direct:startOrder")
>   .to("cxf:bean:orderEndpoint");
> *Sending  a  message  to  the  direct:startOrder  endpoint*  will  invoke 
> a  web  service 
> defined by the orderEndpoint CXF endpoint bean
> 

my problem is how to sending a message to the direct:startOrder endpoint and
it will be send to CXF endpoint by camel?


--
View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642434.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by Willem Jiang <wi...@gmail.com>.
If you can use your component to talk to your platform, the route could be
from("component").to("cxf:xxx").

But you have no clear idea about how to let camel integrate with your 
platform. If you just send out the message to other server, you can 
direct use the camel producerTemplate to do the job.


On 7/28/11 8:24 PM, xiangqiuzhao wrote:
> because my platform need send message to webservice server, socket server,
> ftp server, or other unknow protocol communication, so i want use camel
> send message to some server by the endpoint define, and my platform give the
> message to camel by direct. so if i need to use
> from("direct:myplatform").to("other://") route?
>
> by the way, how to drive the direct route? i means if the route is
> from("mina://ip:port") and the client can use socket connect to the port and
> send message, but how to send message to direct route ?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642403.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by xiangqiuzhao <xi...@gmail.com>.
because my platform need send message to webservice server, socket server,
ftp server, or other unknow protocol communication, so i want use camel 
send message to some server by the endpoint define, and my platform give the
message to camel by direct. so if i need to use
from("direct:myplatform").to("other://") route?

by the way, how to drive the direct route? i means if the route is
from("mina://ip:port") and the client can use socket connect to the port and
send message, but how to send message to direct route ?

--
View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642403.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: how to route once from(myComponent://).to(cxf://) ?

Posted by Willem Jiang <wi...@gmail.com>.
I don't get why you want use camel route to this kind of job.
The camel route is suitable for running as back end service.

If you just need to send the message to the WebServices by hand, you can 
write class to get the request somewhere and use CXF client to send the 
request to the WebServices.


On 7/28/11 6:16 PM, xiangqiuzhao wrote:
> my application need to send message to the other application by webservices.
>
> so i need to execute the message route by hand. how to send once and
> received the response than finished?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-route-once-from-myComponent-to-cxf-tp4642015p4642015.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang