putting a message in some text file using jms and camel from an end point

classic Classic list List threaded Threaded
4 messages Options
skg
Reply | Threaded
Open this post in threaded view
|

putting a message in some text file using jms and camel from an end point

skg
Hi,
I am working on the example to pass a message using jms through camel tooling.I am getting the message on service mix console but i want the message in some file.While doing that i am getting the error.
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)



i am putting my code also to figure out if i have done anything wrong.


from("timer://tutorial?fixedRate=true&period=10000").setBody(constant("<message>Hello saurabh!</message>")).to("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:provider");  // 3

    //...and receive messages sent by other JBI endpoints
    from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").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("file:C:/MavenCheckSender/reports.txt");
Reply | Threaded
Open this post in threaded view
|

RE: putting a message in some text file using jms and camel from an end point

Claus Ibsen
Hi

I do think this has been fixed on the 1.4-SNAPSHOT. (I do think James caught ths problem and fixed it).
Camel 1.4 is about to be released (hopefully this week).

There is a 1.4.0RC2 that you can try out if you need the binaries.

The staging area is at:
http://people.apache.org/~hadrian/apache-camel-1.4.0-RC2/maven2

The tarballs are here:
http://people.apache.org/~hadrian/apache-camel-1.4.0-RC2/maven2/org/apache/camel/apache-camel/1.4.0/


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: skg [mailto:[hidden email]]
Sent: 30. juni 2008 10:05
To: [hidden email]
Subject: putting a message in some text file using jms and camel from an end point


Hi,
I am working on the example to pass a message using jms through camel
tooling.I am getting the message on service mix console but i want the
message in some file.While doing that i am getting the error.
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)


i am putting my code also to figure out if i have done anything wrong.


from("timer://tutorial?fixedRate=true&period=10000").setBody(constant("<message>Hello
saurabh!</message>")).to("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:provider");
// 3

    //...and receive messages sent by other JBI endpoints
   
from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").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("file:C:/MavenCheckSender/reports.txt");
--
View this message in context: http://www.nabble.com/putting-a-message-in-some-text-file-using-jms-and-camel-from-an-end-point-tp18190573s22882p18190573.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

RE: putting a message in some text file using jms and camel from an end point

Claus Ibsen
In reply to this post by skg
Basically a convert from SAXSource to InputStream is missing. You can in the meantime add done yourself.

http://activemq.apache.org/camel/type-converter.html


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: skg [mailto:[hidden email]]
Sent: 30. juni 2008 10:05
To: [hidden email]
Subject: putting a message in some text file using jms and camel from an end point


Hi,
I am working on the example to pass a message using jms through camel
tooling.I am getting the message on service mix console but i want the
message in some file.While doing that i am getting the error.
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)


i am putting my code also to figure out if i have done anything wrong.


from("timer://tutorial?fixedRate=true&period=10000").setBody(constant("<message>Hello
saurabh!</message>")).to("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:provider");
// 3

    //...and receive messages sent by other JBI endpoints
   
from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").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("file:C:/MavenCheckSender/reports.txt");
--
View this message in context: http://www.nabble.com/putting-a-message-in-some-text-file-using-jms-and-camel-from-an-end-point-tp18190573s22882p18190573.html
Sent from the Camel - Users mailing list archive at Nabble.com.

skg
Reply | Threaded
Open this post in threaded view
|

Re: putting a message in some text file using jms and camel from an end point

skg
In reply to this post by skg
Hi,
i did the same thing, the service is deployed but the output file is not created . Can u suggest me the reason for that and send me how to write in a file component. I am able to read from a file component.
skg wrote
Hi,
I am working on the example to pass a message using jms through camel tooling.I am getting the message on service mix console but i want the message in some file.While doing that i am getting the error.
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)



i am putting my code also to figure out if i have done anything wrong.


from("timer://tutorial?fixedRate=true&period=10000").setBody(constant("<message>Hello saurabh!</message>")).to("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:provider");  // 3

    //...and receive messages sent by other JBI endpoints
    from("jbi:endpoint:urn:org:apache:servicemix:tutorial:camel:jms:consumer").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("file:C:/MavenCheckSender/reports.txt");