Hi Claus,
I read your tutorial & learnt from it. Thanks. I adopted the cxf framework
for now.
Regarding my project (as stated above in snippets):
I planted the following camel routing logic at my processor class:
process method - with camel:
public void process(Exchange exchange) throws Exception {
CamelContext camel = new DefaultCamelContext();
camel.start();
Component component = (Component) camel.getComponent("http-provider-su");
Endpoint endpoint = (Endpoint) ((org.apache.camel.Component)
component).createEndpoint("provider:com.amdocs.oxp.esb");
exchange.getIn().setBody("Liav testing here!");
Producer producer = ((org.apache.camel.Endpoint)
endpoint).createProducer();
producer.start();
producer.process(exchange);
producer.stop();
//System.out.println(exchange.getIn().toString() + "process activated by
SU");
}
And got the following exception while SA's jar was deployed:
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-LIAVE02/1885-1231586726193/0-0. On delivery attemp
java.lang.NullPointerException
at
org.apache.servicemix.tutorial.camel.MyProcessor.process(MyProcessor.java:33)
at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:92)
at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:66)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorT
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:75)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:91)
at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:48)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Be advise that line 33 is:Endpoint endpoint = (Endpoint)
((org.apache.camel.Component)
component).createEndpoint("provider:com.amdocs.oxp.esb");
My questions:
1. As bolded above i "fetched" my provider su component by staing it's name
- is it correct?
2. I used the following servicemix object (not camel's) since i work with
servicemix provider endpoint. That's the reason for all the casting in my
code:
import org.apache.servicemix.jbi.deployment.Component;
import org.apache.servicemix.jbi.framework.Endpoint;
Is it correct?
Thank again,
Liav Ezer.
Claus Ibsen-2 wrote:
>
> Hi
>
> You can use the producer template to call an external http server and
> get the response.
>
> See this tutorial:
> http://activemq.apache.org/camel/tutorial-axis-camel.html
>
> From the section - integrating Camel
>
> Its kinda the same but its just uses the producer template to save a
> file. Its the same API for using any of the camel components.
>
> Little sidenote:
> And since you use InOut you should use: requestBody instread of
> sendBody. However Camel is not to stricky about this yet so if you use
> a send instead of request then it should work as well.
>
> The demo shows how to inject a producer template from spring into your
> bean class = your processor. when you have this template you can call
> the external http server and get the response using the requestBody
> method.
>
>
>
>
>
>
>
> On Thu, Jan 8, 2009 at 1:46 PM, Liav Ezer <[email protected]> wrote:
>>
>> Hi,
>>
>> Here is my camel-context:
>>
>> <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> <package>org.apache.servicemix.tutorial.camel</package>
>> </camelContext>
>>
>> <bean id="myProcessor"
>> class="org.apache.servicemix.tutorial.camel.MyProcessor"/>
>>
>> Here is my RouteBuilder java file:
>>
>> public class MyRouteBuilder extends RouteBuilder {
>> public void configure() {
>> from("timer://tutorial?fixedRate=true&delay=3000&period=10000")
>> .setBody(constant(".....................Liav Camel
>> POC......................."))
>> .to("myProcessor");
>>
>> }
>> }
>>
>> Here is my processor java file:
>> public class MyProcessor implements Processor {
>> public void process(Exchange exchange) throws Exception {
>> //WANT TO INITIATE A CALL TO http pROVIDER END POINT & PASS
>> THE
>> 'FROM'
>> // PARAMETRS RECIEVED PROIRE TO THE PROCESSOR INVOKE.
>> }
>> }
>>
>> Thanks.
>> --
>> View this message in context:
>> http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21351142.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>
>
--
View this message in context:
http://www.nabble.com/How-do-i-call-an-HTTP-Provider-end-pont-from-the-process-method--tp21351142s22882p21387207.html
Sent from the Camel - Users mailing list archive at Nabble.com.