You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by skg <sa...@infosys.com> on 2008/06/20 11:48:42 UTC

working with jms

Hi,

I worked with the example which uses jms to receive and send message to web
services. The consumer receives the message on servicemix console but what
if I want the message in some file or some simple java objects such as
hashmap. Can we store our message in that also.

 

Plz help

-- 
View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18026353.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: working with jms

Posted by skg <sa...@infosys.com>.
Hi,
I am still getting the same error.It is creating an empty folder at the
destination with the given name but at service mix it is throwing error.the
error is 
        at java.lang.Thread.run(Thread.java:595)
ERROR - DeadLetterChannel              - On delivery attempt: 2 caught:
org.apac
he.camel.InvalidPayloadException: No in body available of type:
java.io.InputStr
eam but has value: javax.xml.transform.sax.SAXSource@11a70a7 of type:
javax.xml.
transform.sax.SAXSource on the exchange: Exchange[FileMessage:
C:\MavenCheckSend
er\reports.txt]
org.apache.camel.InvalidPayloadException: No in body available of type:
java.io.
InputStream but has value: javax.xml.transform.sax.SAXSource@11a70a7 of
type: ja
vax.xml.transform.sax.SAXSource on the exchange: Exchange[FileMessage:
C:\MavenC
heckSender\reports.txt]
        at
org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
r.java:117)
        at
org.apache.camel.component.file.FileProducer.process(FileProducer.jav
a:71)
        at
org.apache.camel.component.file.FileProducer.process(FileProducer.jav
a:60)
        at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
ToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
3)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
l.java:136)
James.Strachan wrote:
> 
> try this...
> 
> from(...).process(
>  new Processor() {
>     public void process(Exchange exchange) {
>        Message in = exchange.getIn();
>        StreamSource source = in.getBody(StreamSource.class);
>        if (source != null) {
>            in.setBody(source.getInputStream());
>        }
>    }
> }).
> to(...)
> 
> 
> 
> 2008/6/23 skg <sa...@infosys.com>:
>>
>> Hi,
>> In your specified code u have used an object "in".But u have not
>> specified
>> to which class it belongs.kindly review the code and resolve the issue.
>>
>> James.Strachan wrote:
>>>
>>> Yes - StreamSource is from JAXP...
>>>
>>> Google found this btw :)
>>> http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/stream/StreamSource.html
>>>
>>>
>>> 2008/6/23 skg <sa...@infosys.com>:
>>>>
>>>> Hi,
>>>> I applied the changes u have made and i am getting some compilation
>>>> errors.Do i need to import some package or and additional thing. The
>>>> error
>>>> is
>>>> [INFO] [compiler:compile]
>>>> [INFO] Compiling 1 source file to
>>>> C:\Parent\tutorial-camel-su\target\classes
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [ERROR] BUILD FAILURE
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] Compilation failure
>>>>
>>>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>>>> yRouteBuilder.java:[39,148] cannot find symbol
>>>> symbol: class StreamSource
>>>>
>>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>>>> ").process(new Processor(){public void process(Exchange exchange) {
>>>> StreamSource
>>>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>>>> null)
>>>> {in.s
>>>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>>>
>>>>
>>>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>>>> yRouteBuilder.java:[39,195] cannot find symbol
>>>> symbol: class StreamSource
>>>>
>>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>>>> ").process(new Processor(){public void process(Exchange exchange) {
>>>> StreamSource
>>>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>>>> null)
>>>> {in.s
>>>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>>>
>>>>
>>>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>>>> yRouteBuilder.java:[39,236] cannot find symbol
>>>> symbol: variable in
>>>>
>>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>>>> ").process(new Processor(){public void process(Exchange exchange) {
>>>> StreamSource
>>>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>>>> null)
>>>> {in.s
>>>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>>>
>>>> James.Strachan wrote:
>>>>>
>>>>> This looks like a minor bug in the out-of-the-box type converters in
>>>>> Camel...
>>>>>
>>>>> https://issues.apache.org/activemq/browse/CAMEL-624
>>>>>
>>>>> I've just applied a patch so this will be fixed in 1.4.0. In the
>>>>> meantime you can add a processor to fix this...
>>>>>
>>>>> from(...).process(
>>>>>   new Processor() {
>>>>>      public void process(Exchange exchange) {
>>>>>         StreamSource source =
>>>>> exchange.getIn().getBody(StreamSource.class);
>>>>>         if (source != null) {
>>>>>             in.setBody(source.getInputStream());
>>>>>         }
>>>>>     }
>>>>> }).
>>>>> to(...)
>>>>>
>>>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>>>
>>>>>> Hi,
>>>>>> I am getting some error i am working on the third example given on
>>>>>> tutorial
>>>>>> and i replace the code in the tutorial with
>>>>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt");
>>>>>> but i am not getting any output in it and in service mix it is
>>>>>> showing
>>>>>>       at java.lang.Thread.run(Thread.java:595)
>>>>>> ERROR - DeadLetterChannel              - On delivery attempt: 1
>>>>>> caught:
>>>>>> org.apac
>>>>>> e.camel.InvalidPayloadException: No in body available of type:
>>>>>> java.io.InputStr
>>>>>> am but has value: StringSource[<?xml version="1.0"
>>>>>> encoding="UTF-8"?><message>H
>>>>>> llo saurabh!</message>] of type:
>>>>>> org.apache.servicemix.jbi.jaxp.StringSource
>>>>>> on
>>>>>> the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
>>>>>> rg.apache.camel.InvalidPayloadException: No in body available of
>>>>>> type:
>>>>>> java.io.
>>>>>> nputStream but has value: StringSource[<?xml version="1.0"
>>>>>> encoding="UTF-8"?><m
>>>>>> ssage>Hello saurabh!</message>] of type:
>>>>>> org.apache.servicemix.jbi.jaxp.StringS
>>>>>> urce on the exchange: Exchange[FileMessage:
>>>>>> C:\MavenCheckSender\reports.txt]
>>>>>>       at
>>>>>> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
>>>>>> .java:117)
>>>>>>       at
>>>>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>>>>> :71)
>>>>>>       at
>>>>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>>>>> :60)
>>>>>>       at
>>>>>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
>>>>>> oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>>>>>>       at
>>>>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
>>>>>> )
>>>>>>       at
>>>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>>>>> .java:136)
>>>>>>       at
>>>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>>>>> .java:86)
>>>>>>       at
>>>>>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
>>>>>> ssor.java:40)
>>>>>>       at
>>>>>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
>>>>>> r.java:44)
>>>>>>       at
>>>>>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
>>>>>> cProcessor.java:68)
>>>>>>       at
>>>>>> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
>>>>>> point.java:64)
>>>>>>       at
>>>>>> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
>>>>>> erEndpoint.java:100)
>>>>>>       at
>>>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
>>>>>> eCycle.java:538)
>>>>>>       at
>>>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
>>>>>> aseLifeCycle.java:490)
>>>>>>       at
>>>>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
>>>>>> ycle.java:46)
>>>>>>       at
>>>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
>>>>>> (DeliveryChannelImpl.java:610)
>>>>>>       at
>>>>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
>>>>>> .java:172)
>>>>>>       at
>>>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
>>>>>> va:167)
>>>>>>       at
>>>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
>>>>>> :134)
>>>>>>       at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
>>>>>> tor.java:650)
>>>>>>       at
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>>>>>> java:675)
>>>>>>       at java.lang.Thread.run(Thread.java:595)
>>>>>>
>>>>>>
>>>>>> James.Strachan wrote:
>>>>>>>
>>>>>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I worked with the example which uses jms to receive and send
>>>>>>>> message
>>>>>>>> to
>>>>>>>> web
>>>>>>>> services. The consumer receives the message on servicemix console
>>>>>>>> but
>>>>>>>> what
>>>>>>>> if I want the message in some file or some simple java objects such
>>>>>>>> as
>>>>>>>> hashmap. Can we store our message in that also.
>>>>>>>
>>>>>>> Reply soon
>>>>>>>
>>>>>>> So send to a file use the file endpoint...
>>>>>>> http://activemq.apache.org/camel/file.html
>>>>>>>
>>>>>>> e.g.
>>>>>>>
>>>>>>> from("activemq:SomeQueue").to("file://someDir");
>>>>>>>
>>>>>>> To work with beans and hashmaps, just send the message to a bean...
>>>>>>> http://activemq.apache.org/camel/bean-integration.html
>>>>>>>
>>>>>>> --
>>>>>>> James
>>>>>>> -------
>>>>>>> http://macstrac.blogspot.com/
>>>>>>>
>>>>>>> Open Source Integration
>>>>>>> http://open.iona.com
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> James
>>>>> -------
>>>>> http://macstrac.blogspot.com/
>>>>>
>>>>> Open Source Integration
>>>>> http://open.iona.com
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/working-with-jms-tp18026353s22882p18063097.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://open.iona.com
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/working-with-jms-tp18026353s22882p18065443.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18065893.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: working with jms

Posted by James Strachan <ja...@gmail.com>.
try this...

from(...).process(
 new Processor() {
    public void process(Exchange exchange) {
       Message in = exchange.getIn();
       StreamSource source = in.getBody(StreamSource.class);
       if (source != null) {
           in.setBody(source.getInputStream());
       }
   }
}).
to(...)



2008/6/23 skg <sa...@infosys.com>:
>
> Hi,
> In your specified code u have used an object "in".But u have not specified
> to which class it belongs.kindly review the code and resolve the issue.
>
> James.Strachan wrote:
>>
>> Yes - StreamSource is from JAXP...
>>
>> Google found this btw :)
>> http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/stream/StreamSource.html
>>
>>
>> 2008/6/23 skg <sa...@infosys.com>:
>>>
>>> Hi,
>>> I applied the changes u have made and i am getting some compilation
>>> errors.Do i need to import some package or and additional thing. The
>>> error
>>> is
>>> [INFO] [compiler:compile]
>>> [INFO] Compiling 1 source file to
>>> C:\Parent\tutorial-camel-su\target\classes
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [ERROR] BUILD FAILURE
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] Compilation failure
>>>
>>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>>> yRouteBuilder.java:[39,148] cannot find symbol
>>> symbol: class StreamSource
>>>
>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>>> ").process(new Processor(){public void process(Exchange exchange) {
>>> StreamSource
>>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>>> null)
>>> {in.s
>>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>>
>>>
>>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>>> yRouteBuilder.java:[39,195] cannot find symbol
>>> symbol: class StreamSource
>>>
>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>>> ").process(new Processor(){public void process(Exchange exchange) {
>>> StreamSource
>>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>>> null)
>>> {in.s
>>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>>
>>>
>>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>>> yRouteBuilder.java:[39,236] cannot find symbol
>>> symbol: variable in
>>>
>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>>> ").process(new Processor(){public void process(Exchange exchange) {
>>> StreamSource
>>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>>> null)
>>> {in.s
>>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>>
>>> James.Strachan wrote:
>>>>
>>>> This looks like a minor bug in the out-of-the-box type converters in
>>>> Camel...
>>>>
>>>> https://issues.apache.org/activemq/browse/CAMEL-624
>>>>
>>>> I've just applied a patch so this will be fixed in 1.4.0. In the
>>>> meantime you can add a processor to fix this...
>>>>
>>>> from(...).process(
>>>>   new Processor() {
>>>>      public void process(Exchange exchange) {
>>>>         StreamSource source =
>>>> exchange.getIn().getBody(StreamSource.class);
>>>>         if (source != null) {
>>>>             in.setBody(source.getInputStream());
>>>>         }
>>>>     }
>>>> }).
>>>> to(...)
>>>>
>>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>>
>>>>> Hi,
>>>>> I am getting some error i am working on the third example given on
>>>>> tutorial
>>>>> and i replace the code in the tutorial with
>>>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt");
>>>>> but i am not getting any output in it and in service mix it is showing
>>>>>       at java.lang.Thread.run(Thread.java:595)
>>>>> ERROR - DeadLetterChannel              - On delivery attempt: 1 caught:
>>>>> org.apac
>>>>> e.camel.InvalidPayloadException: No in body available of type:
>>>>> java.io.InputStr
>>>>> am but has value: StringSource[<?xml version="1.0"
>>>>> encoding="UTF-8"?><message>H
>>>>> llo saurabh!</message>] of type:
>>>>> org.apache.servicemix.jbi.jaxp.StringSource
>>>>> on
>>>>> the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
>>>>> rg.apache.camel.InvalidPayloadException: No in body available of type:
>>>>> java.io.
>>>>> nputStream but has value: StringSource[<?xml version="1.0"
>>>>> encoding="UTF-8"?><m
>>>>> ssage>Hello saurabh!</message>] of type:
>>>>> org.apache.servicemix.jbi.jaxp.StringS
>>>>> urce on the exchange: Exchange[FileMessage:
>>>>> C:\MavenCheckSender\reports.txt]
>>>>>       at
>>>>> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
>>>>> .java:117)
>>>>>       at
>>>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>>>> :71)
>>>>>       at
>>>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>>>> :60)
>>>>>       at
>>>>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
>>>>> oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>>>>>       at
>>>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
>>>>> )
>>>>>       at
>>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>>>> .java:136)
>>>>>       at
>>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>>>> .java:86)
>>>>>       at
>>>>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
>>>>> ssor.java:40)
>>>>>       at
>>>>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
>>>>> r.java:44)
>>>>>       at
>>>>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
>>>>> cProcessor.java:68)
>>>>>       at
>>>>> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
>>>>> point.java:64)
>>>>>       at
>>>>> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
>>>>> erEndpoint.java:100)
>>>>>       at
>>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
>>>>> eCycle.java:538)
>>>>>       at
>>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
>>>>> aseLifeCycle.java:490)
>>>>>       at
>>>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
>>>>> ycle.java:46)
>>>>>       at
>>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
>>>>> (DeliveryChannelImpl.java:610)
>>>>>       at
>>>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
>>>>> .java:172)
>>>>>       at
>>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
>>>>> va:167)
>>>>>       at
>>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
>>>>> :134)
>>>>>       at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
>>>>> tor.java:650)
>>>>>       at
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>>>>> java:675)
>>>>>       at java.lang.Thread.run(Thread.java:595)
>>>>>
>>>>>
>>>>> James.Strachan wrote:
>>>>>>
>>>>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I worked with the example which uses jms to receive and send message
>>>>>>> to
>>>>>>> web
>>>>>>> services. The consumer receives the message on servicemix console but
>>>>>>> what
>>>>>>> if I want the message in some file or some simple java objects such
>>>>>>> as
>>>>>>> hashmap. Can we store our message in that also.
>>>>>>
>>>>>> Reply soon
>>>>>>
>>>>>> So send to a file use the file endpoint...
>>>>>> http://activemq.apache.org/camel/file.html
>>>>>>
>>>>>> e.g.
>>>>>>
>>>>>> from("activemq:SomeQueue").to("file://someDir");
>>>>>>
>>>>>> To work with beans and hashmaps, just send the message to a bean...
>>>>>> http://activemq.apache.org/camel/bean-integration.html
>>>>>>
>>>>>> --
>>>>>> James
>>>>>> -------
>>>>>> http://macstrac.blogspot.com/
>>>>>>
>>>>>> Open Source Integration
>>>>>> http://open.iona.com
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>>
>>>> Open Source Integration
>>>> http://open.iona.com
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/working-with-jms-tp18026353s22882p18063097.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
>>
>
> --
> View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18065443.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: working with jms

Posted by skg <sa...@infosys.com>.
Hi,
In your specified code u have used an object "in".But u have not specified
to which class it belongs.kindly review the code and resolve the issue.

James.Strachan wrote:
> 
> Yes - StreamSource is from JAXP...
> 
> Google found this btw :)
> http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/stream/StreamSource.html
> 
> 
> 2008/6/23 skg <sa...@infosys.com>:
>>
>> Hi,
>> I applied the changes u have made and i am getting some compilation
>> errors.Do i need to import some package or and additional thing. The
>> error
>> is
>> [INFO] [compiler:compile]
>> [INFO] Compiling 1 source file to
>> C:\Parent\tutorial-camel-su\target\classes
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] BUILD FAILURE
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Compilation failure
>>
>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>> yRouteBuilder.java:[39,148] cannot find symbol
>> symbol: class StreamSource
>>
>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>> ").process(new Processor(){public void process(Exchange exchange) {
>> StreamSource
>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>> null)
>> {in.s
>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>
>>
>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>> yRouteBuilder.java:[39,195] cannot find symbol
>> symbol: class StreamSource
>>
>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>> ").process(new Processor(){public void process(Exchange exchange) {
>> StreamSource
>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>> null)
>> {in.s
>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>
>>
>> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
>> yRouteBuilder.java:[39,236] cannot find symbol
>> symbol: variable in
>>
>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
>> ").process(new Processor(){public void process(Exchange exchange) {
>> StreamSource
>>  source = exchange.getIn().getBody(StreamSource.class);if (source !=
>> null)
>> {in.s
>> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>>
>> James.Strachan wrote:
>>>
>>> This looks like a minor bug in the out-of-the-box type converters in
>>> Camel...
>>>
>>> https://issues.apache.org/activemq/browse/CAMEL-624
>>>
>>> I've just applied a patch so this will be fixed in 1.4.0. In the
>>> meantime you can add a processor to fix this...
>>>
>>> from(...).process(
>>>   new Processor() {
>>>      public void process(Exchange exchange) {
>>>         StreamSource source =
>>> exchange.getIn().getBody(StreamSource.class);
>>>         if (source != null) {
>>>             in.setBody(source.getInputStream());
>>>         }
>>>     }
>>> }).
>>> to(...)
>>>
>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>
>>>> Hi,
>>>> I am getting some error i am working on the third example given on
>>>> tutorial
>>>> and i replace the code in the tutorial with
>>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt");
>>>> but i am not getting any output in it and in service mix it is showing
>>>>       at java.lang.Thread.run(Thread.java:595)
>>>> ERROR - DeadLetterChannel              - On delivery attempt: 1 caught:
>>>> org.apac
>>>> e.camel.InvalidPayloadException: No in body available of type:
>>>> java.io.InputStr
>>>> am but has value: StringSource[<?xml version="1.0"
>>>> encoding="UTF-8"?><message>H
>>>> llo saurabh!</message>] of type:
>>>> org.apache.servicemix.jbi.jaxp.StringSource
>>>> on
>>>> the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
>>>> rg.apache.camel.InvalidPayloadException: No in body available of type:
>>>> java.io.
>>>> nputStream but has value: StringSource[<?xml version="1.0"
>>>> encoding="UTF-8"?><m
>>>> ssage>Hello saurabh!</message>] of type:
>>>> org.apache.servicemix.jbi.jaxp.StringS
>>>> urce on the exchange: Exchange[FileMessage:
>>>> C:\MavenCheckSender\reports.txt]
>>>>       at
>>>> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
>>>> .java:117)
>>>>       at
>>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>>> :71)
>>>>       at
>>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>>> :60)
>>>>       at
>>>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
>>>> oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>>>>       at
>>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
>>>> )
>>>>       at
>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>>> .java:136)
>>>>       at
>>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>>> .java:86)
>>>>       at
>>>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
>>>> ssor.java:40)
>>>>       at
>>>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
>>>> r.java:44)
>>>>       at
>>>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
>>>> cProcessor.java:68)
>>>>       at
>>>> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
>>>> point.java:64)
>>>>       at
>>>> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
>>>> erEndpoint.java:100)
>>>>       at
>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
>>>> eCycle.java:538)
>>>>       at
>>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
>>>> aseLifeCycle.java:490)
>>>>       at
>>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
>>>> ycle.java:46)
>>>>       at
>>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
>>>> (DeliveryChannelImpl.java:610)
>>>>       at
>>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
>>>> .java:172)
>>>>       at
>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
>>>> va:167)
>>>>       at
>>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
>>>> :134)
>>>>       at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
>>>> tor.java:650)
>>>>       at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>>>> java:675)
>>>>       at java.lang.Thread.run(Thread.java:595)
>>>>
>>>>
>>>> James.Strachan wrote:
>>>>>
>>>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I worked with the example which uses jms to receive and send message
>>>>>> to
>>>>>> web
>>>>>> services. The consumer receives the message on servicemix console but
>>>>>> what
>>>>>> if I want the message in some file or some simple java objects such
>>>>>> as
>>>>>> hashmap. Can we store our message in that also.
>>>>>
>>>>> Reply soon
>>>>>
>>>>> So send to a file use the file endpoint...
>>>>> http://activemq.apache.org/camel/file.html
>>>>>
>>>>> e.g.
>>>>>
>>>>> from("activemq:SomeQueue").to("file://someDir");
>>>>>
>>>>> To work with beans and hashmaps, just send the message to a bean...
>>>>> http://activemq.apache.org/camel/bean-integration.html
>>>>>
>>>>> --
>>>>> James
>>>>> -------
>>>>> http://macstrac.blogspot.com/
>>>>>
>>>>> Open Source Integration
>>>>> http://open.iona.com
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://open.iona.com
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/working-with-jms-tp18026353s22882p18063097.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18065443.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: working with jms

Posted by James Strachan <ja...@gmail.com>.
Yes - StreamSource is from JAXP...

Google found this btw :)
http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/stream/StreamSource.html


2008/6/23 skg <sa...@infosys.com>:
>
> Hi,
> I applied the changes u have made and i am getting some compilation
> errors.Do i need to import some package or and additional thing. The error
> is
> [INFO] [compiler:compile]
> [INFO] Compiling 1 source file to C:\Parent\tutorial-camel-su\target\classes
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Compilation failure
>
> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
> yRouteBuilder.java:[39,148] cannot find symbol
> symbol: class StreamSource
>
> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
> ").process(new Processor(){public void process(Exchange exchange) {
> StreamSource
>  source = exchange.getIn().getBody(StreamSource.class);if (source != null)
> {in.s
> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>
>
> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
> yRouteBuilder.java:[39,195] cannot find symbol
> symbol: class StreamSource
>
> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
> ").process(new Processor(){public void process(Exchange exchange) {
> StreamSource
>  source = exchange.getIn().getBody(StreamSource.class);if (source != null)
> {in.s
> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>
>
> C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
> yRouteBuilder.java:[39,236] cannot find symbol
> symbol: variable in
>
> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
> ").process(new Processor(){public void process(Exchange exchange) {
> StreamSource
>  source = exchange.getIn().getBody(StreamSource.class);if (source != null)
> {in.s
> etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");
>
> James.Strachan wrote:
>>
>> This looks like a minor bug in the out-of-the-box type converters in
>> Camel...
>>
>> https://issues.apache.org/activemq/browse/CAMEL-624
>>
>> I've just applied a patch so this will be fixed in 1.4.0. In the
>> meantime you can add a processor to fix this...
>>
>> from(...).process(
>>   new Processor() {
>>      public void process(Exchange exchange) {
>>         StreamSource source =
>> exchange.getIn().getBody(StreamSource.class);
>>         if (source != null) {
>>             in.setBody(source.getInputStream());
>>         }
>>     }
>> }).
>> to(...)
>>
>> 2008/6/20 skg <sa...@infosys.com>:
>>>
>>> Hi,
>>> I am getting some error i am working on the third example given on
>>> tutorial
>>> and i replace the code in the tutorial with
>>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt");
>>> but i am not getting any output in it and in service mix it is showing
>>>       at java.lang.Thread.run(Thread.java:595)
>>> ERROR - DeadLetterChannel              - On delivery attempt: 1 caught:
>>> org.apac
>>> e.camel.InvalidPayloadException: No in body available of type:
>>> java.io.InputStr
>>> am but has value: StringSource[<?xml version="1.0"
>>> encoding="UTF-8"?><message>H
>>> llo saurabh!</message>] of type:
>>> org.apache.servicemix.jbi.jaxp.StringSource
>>> on
>>> the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
>>> rg.apache.camel.InvalidPayloadException: No in body available of type:
>>> java.io.
>>> nputStream but has value: StringSource[<?xml version="1.0"
>>> encoding="UTF-8"?><m
>>> ssage>Hello saurabh!</message>] of type:
>>> org.apache.servicemix.jbi.jaxp.StringS
>>> urce on the exchange: Exchange[FileMessage:
>>> C:\MavenCheckSender\reports.txt]
>>>       at
>>> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
>>> .java:117)
>>>       at
>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>> :71)
>>>       at
>>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>>> :60)
>>>       at
>>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
>>> oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>>>       at
>>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
>>> )
>>>       at
>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>> .java:136)
>>>       at
>>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>>> .java:86)
>>>       at
>>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
>>> ssor.java:40)
>>>       at
>>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
>>> r.java:44)
>>>       at
>>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
>>> cProcessor.java:68)
>>>       at
>>> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
>>> point.java:64)
>>>       at
>>> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
>>> erEndpoint.java:100)
>>>       at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
>>> eCycle.java:538)
>>>       at
>>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
>>> aseLifeCycle.java:490)
>>>       at
>>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
>>> ycle.java:46)
>>>       at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
>>> (DeliveryChannelImpl.java:610)
>>>       at
>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
>>> .java:172)
>>>       at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
>>> va:167)
>>>       at
>>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
>>> :134)
>>>       at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
>>> tor.java:650)
>>>       at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>>> java:675)
>>>       at java.lang.Thread.run(Thread.java:595)
>>>
>>>
>>> James.Strachan wrote:
>>>>
>>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I worked with the example which uses jms to receive and send message to
>>>>> web
>>>>> services. The consumer receives the message on servicemix console but
>>>>> what
>>>>> if I want the message in some file or some simple java objects such as
>>>>> hashmap. Can we store our message in that also.
>>>>
>>>> Reply soon
>>>>
>>>> So send to a file use the file endpoint...
>>>> http://activemq.apache.org/camel/file.html
>>>>
>>>> e.g.
>>>>
>>>> from("activemq:SomeQueue").to("file://someDir");
>>>>
>>>> To work with beans and hashmaps, just send the message to a bean...
>>>> http://activemq.apache.org/camel/bean-integration.html
>>>>
>>>> --
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>>
>>>> Open Source Integration
>>>> http://open.iona.com
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
>>
>
> --
> View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18063097.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: working with jms

Posted by skg <sa...@infosys.com>.
Hi,
I applied the changes u have made and i am getting some compilation
errors.Do i need to import some package or and additional thing. The error
is
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to C:\Parent\tutorial-camel-su\target\classes
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure

C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
yRouteBuilder.java:[39,148] cannot find symbol
symbol: class StreamSource
       
from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
").process(new Processor(){public void process(Exchange exchange) {
StreamSource
 source = exchange.getIn().getBody(StreamSource.class);if (source != null)
{in.s
etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");


C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
yRouteBuilder.java:[39,195] cannot find symbol
symbol: class StreamSource
       
from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
").process(new Processor(){public void process(Exchange exchange) {
StreamSource
 source = exchange.getIn().getBody(StreamSource.class);if (source != null)
{in.s
etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");


C:\Parent\tutorial-camel-su\src\main\java\org\apache\servicemix\tutorial\camel\M
yRouteBuilder.java:[39,236] cannot find symbol
symbol: variable in
       
from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer
").process(new Processor(){public void process(Exchange exchange) {
StreamSource
 source = exchange.getIn().getBody(StreamSource.class);if (source != null)
{in.s
etBody(source.getInputStream());}}}).to("file:C:/MavenCheckSender/reports.txt");

James.Strachan wrote:
> 
> This looks like a minor bug in the out-of-the-box type converters in
> Camel...
> 
> https://issues.apache.org/activemq/browse/CAMEL-624
> 
> I've just applied a patch so this will be fixed in 1.4.0. In the
> meantime you can add a processor to fix this...
> 
> from(...).process(
>   new Processor() {
>      public void process(Exchange exchange) {
>         StreamSource source =
> exchange.getIn().getBody(StreamSource.class);
>         if (source != null) {
>             in.setBody(source.getInputStream());
>         }
>     }
> }).
> to(...)
> 
> 2008/6/20 skg <sa...@infosys.com>:
>>
>> Hi,
>> I am getting some error i am working on the third example given on
>> tutorial
>> and i replace the code in the tutorial with
>> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt");
>> but i am not getting any output in it and in service mix it is showing
>>       at java.lang.Thread.run(Thread.java:595)
>> ERROR - DeadLetterChannel              - On delivery attempt: 1 caught:
>> org.apac
>> e.camel.InvalidPayloadException: No in body available of type:
>> java.io.InputStr
>> am but has value: StringSource[<?xml version="1.0"
>> encoding="UTF-8"?><message>H
>> llo saurabh!</message>] of type:
>> org.apache.servicemix.jbi.jaxp.StringSource
>> on
>> the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
>> rg.apache.camel.InvalidPayloadException: No in body available of type:
>> java.io.
>> nputStream but has value: StringSource[<?xml version="1.0"
>> encoding="UTF-8"?><m
>> ssage>Hello saurabh!</message>] of type:
>> org.apache.servicemix.jbi.jaxp.StringS
>> urce on the exchange: Exchange[FileMessage:
>> C:\MavenCheckSender\reports.txt]
>>       at
>> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
>> .java:117)
>>       at
>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>> :71)
>>       at
>> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
>> :60)
>>       at
>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
>> oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>>       at
>> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
>> )
>>       at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>> .java:136)
>>       at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
>> .java:86)
>>       at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
>> ssor.java:40)
>>       at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
>> r.java:44)
>>       at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
>> cProcessor.java:68)
>>       at
>> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
>> point.java:64)
>>       at
>> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
>> erEndpoint.java:100)
>>       at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
>> eCycle.java:538)
>>       at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
>> aseLifeCycle.java:490)
>>       at
>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
>> ycle.java:46)
>>       at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
>> (DeliveryChannelImpl.java:610)
>>       at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
>> .java:172)
>>       at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
>> va:167)
>>       at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
>> :134)
>>       at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
>> tor.java:650)
>>       at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>> java:675)
>>       at java.lang.Thread.run(Thread.java:595)
>>
>>
>> James.Strachan wrote:
>>>
>>> 2008/6/20 skg <sa...@infosys.com>:
>>>>
>>>> Hi,
>>>>
>>>> I worked with the example which uses jms to receive and send message to
>>>> web
>>>> services. The consumer receives the message on servicemix console but
>>>> what
>>>> if I want the message in some file or some simple java objects such as
>>>> hashmap. Can we store our message in that also.
>>>
>>> Reply soon
>>>
>>> So send to a file use the file endpoint...
>>> http://activemq.apache.org/camel/file.html
>>>
>>> e.g.
>>>
>>> from("activemq:SomeQueue").to("file://someDir");
>>>
>>> To work with beans and hashmaps, just send the message to a bean...
>>> http://activemq.apache.org/camel/bean-integration.html
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://open.iona.com
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18063097.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: working with jms

Posted by James Strachan <ja...@gmail.com>.
This looks like a minor bug in the out-of-the-box type converters in Camel...

https://issues.apache.org/activemq/browse/CAMEL-624

I've just applied a patch so this will be fixed in 1.4.0. In the
meantime you can add a processor to fix this...

from(...).process(
  new Processor() {
     public void process(Exchange exchange) {
        StreamSource source = exchange.getIn().getBody(StreamSource.class);
        if (source != null) {
            in.setBody(source.getInputStream());
        }
    }
}).
to(...)

2008/6/20 skg <sa...@infosys.com>:
>
> Hi,
> I am getting some error i am working on the third example given on tutorial
> and i replace the code in the tutorial with
> from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt");
> but i am not getting any output in it and in service mix it is showing
>       at java.lang.Thread.run(Thread.java:595)
> ERROR - DeadLetterChannel              - On delivery attempt: 1 caught:
> org.apac
> e.camel.InvalidPayloadException: No in body available of type:
> java.io.InputStr
> am but has value: StringSource[<?xml version="1.0"
> encoding="UTF-8"?><message>H
> llo saurabh!</message>] of type: org.apache.servicemix.jbi.jaxp.StringSource
> on
> the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
> rg.apache.camel.InvalidPayloadException: No in body available of type:
> java.io.
> nputStream but has value: StringSource[<?xml version="1.0"
> encoding="UTF-8"?><m
> ssage>Hello saurabh!</message>] of type:
> org.apache.servicemix.jbi.jaxp.StringS
> urce on the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
>       at
> org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
> .java:117)
>       at
> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
> :71)
>       at
> org.apache.camel.component.file.FileProducer.process(FileProducer.jav
> :60)
>       at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
> oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>       at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
> )
>       at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
> .java:136)
>       at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
> .java:86)
>       at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
> ssor.java:40)
>       at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
> r.java:44)
>       at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
> cProcessor.java:68)
>       at
> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
> point.java:64)
>       at
> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
> erEndpoint.java:100)
>       at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
> eCycle.java:538)
>       at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
> aseLifeCycle.java:490)
>       at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
> ycle.java:46)
>       at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
> (DeliveryChannelImpl.java:610)
>       at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
> .java:172)
>       at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
> va:167)
>       at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
> :134)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
> tor.java:650)
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
> java:675)
>       at java.lang.Thread.run(Thread.java:595)
>
>
> James.Strachan wrote:
>>
>> 2008/6/20 skg <sa...@infosys.com>:
>>>
>>> Hi,
>>>
>>> I worked with the example which uses jms to receive and send message to
>>> web
>>> services. The consumer receives the message on servicemix console but
>>> what
>>> if I want the message in some file or some simple java objects such as
>>> hashmap. Can we store our message in that also.
>>
>> Reply soon
>>
>> So send to a file use the file endpoint...
>> http://activemq.apache.org/camel/file.html
>>
>> e.g.
>>
>> from("activemq:SomeQueue").to("file://someDir");
>>
>> To work with beans and hashmaps, just send the message to a bean...
>> http://activemq.apache.org/camel/bean-integration.html
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
>>
>
> --
> View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: working with jms

Posted by skg <sa...@infosys.com>.
Hi,
I am getting some error i am working on the third example given on tutorial
and i replace the code in the tutorial with
from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").to("file:C:/MavenCheckSender/reports.txt"); 
but i am not getting any output in it and in service mix it is showing
       at java.lang.Thread.run(Thread.java:595)
ERROR - DeadLetterChannel              - On delivery attempt: 1 caught:
org.apac
e.camel.InvalidPayloadException: No in body available of type:
java.io.InputStr
am but has value: StringSource[<?xml version="1.0"
encoding="UTF-8"?><message>H
llo saurabh!</message>] of type: org.apache.servicemix.jbi.jaxp.StringSource
on
the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
rg.apache.camel.InvalidPayloadException: No in body available of type:
java.io.
nputStream but has value: StringSource[<?xml version="1.0"
encoding="UTF-8"?><m
ssage>Hello saurabh!</message>] of type:
org.apache.servicemix.jbi.jaxp.StringS
urce on the exchange: Exchange[FileMessage: C:\MavenCheckSender\reports.txt]
       at
org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelpe
.java:117)
       at
org.apache.camel.component.file.FileProducer.process(FileProducer.jav
:71)
       at
org.apache.camel.component.file.FileProducer.process(FileProducer.jav
:60)
       at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$Processor
oAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
       at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:7
)
       at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
.java:136)
       at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChanne
.java:86)
       at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc
ssor.java:40)
       at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp
r.java:44)
       at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy
cProcessor.java:68)
       at
org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEn
point.java:64)
       at
org.apache.servicemix.common.endpoints.ProviderEndpoint.process(Provi
erEndpoint.java:100)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
eCycle.java:538)
       at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
aseLifeCycle.java:490)
       at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
ycle.java:46)
       at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
(DeliveryChannelImpl.java:610)
       at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
.java:172)
       at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
va:167)
       at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
:134)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
tor.java:650)
       at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
java:675)
       at java.lang.Thread.run(Thread.java:595)


James.Strachan wrote:
> 
> 2008/6/20 skg <sa...@infosys.com>:
>>
>> Hi,
>>
>> I worked with the example which uses jms to receive and send message to
>> web
>> services. The consumer receives the message on servicemix console but
>> what
>> if I want the message in some file or some simple java objects such as
>> hashmap. Can we store our message in that also.
> 
> Reply soon
> 
> So send to a file use the file endpoint...
> http://activemq.apache.org/camel/file.html
> 
> e.g.
> 
> from("activemq:SomeQueue").to("file://someDir");
> 
> To work with beans and hashmaps, just send the message to a bean...
> http://activemq.apache.org/camel/bean-integration.html
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/working-with-jms-tp18026353s22882p18026676.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: working with jms

Posted by James Strachan <ja...@gmail.com>.
2008/6/20 skg <sa...@infosys.com>:
>
> Hi,
>
> I worked with the example which uses jms to receive and send message to web
> services. The consumer receives the message on servicemix console but what
> if I want the message in some file or some simple java objects such as
> hashmap. Can we store our message in that also.

So send to a file use the file endpoint...
http://activemq.apache.org/camel/file.html

e.g.

from("activemq:SomeQueue").to("file://someDir");

To work with beans and hashmaps, just send the message to a bean...
http://activemq.apache.org/camel/bean-integration.html

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com