You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by GibKing <gi...@byteholder.de> on 2010/04/26 18:26:51 UTC
Recieving BlobMessages routed with Camel
Hi everyone,
i like to send files over ActiveMQ using the following setup.
Code snippet to send the file:
BlobMessage message = session.createBlobMessage(inputStream);
message.setJMSType("Filetransfer");
message.setStringProperty("Filename", filename);
ActiveMQQueue queue = (ActiveMQQueue) session.createQueue("filequeue");
MessageProducer producer = session.createProducer(queue);
producer.send(message);
Camel Configuration snippet: (camel.xml)
<route>
<from uri="activemq:filequeue">
<to uri="bean:filehandler">
</route>
<!-- beanconfiguration.... -->
An finally the filehandler:
public class FileHandler{
@Handler
public void onMessage(Exchange exchange){
....
}
My question is how i can get an ActiveMQBlobMessage (or the InputStream)
inside my filehandler.
Is this possible after all?
greets
GibKing
--
View this message in context: http://old.nabble.com/Recieving-BlobMessages-routed-with-Camel-tp28367084p28367084.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Recieving BlobMessages routed with Camel
Posted by GibKing <gi...@byteholder.de>.
On my way home i thought about it and came to the conclusion that there maybe
a bug in camel handling the outgoing exchange.
Im going to look at the camel-source if i can find anything...
--
View this message in context: http://old.nabble.com/Recieving-BlobMessages-routed-with-Camel-tp28367084p28477091.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Recieving BlobMessages routed with Camel
Posted by GibKing <gi...@byteholder.de>.
Hi Claus,
this actually works only with a single route.
<route>
<from uri="activemq:filequeue?mapJmsMessage=false">
<to uri="bean:filehandler">
</route>
public class FileHandler{
@Handler
public void onMessage(Exchange exchange){
exchange.getIn().getBody().getClass() == ActiveMQBlobMessage
}
but with this routing(tested on single broker and network of 2 brokers):
<route>
<from uri="activemq:filequeue?mapJmsMessage=false">
<to uri="activemq:filequeue2?mapJmsMessage=false">
</route>
<route>
<from uri="activemq:filequeue2?mapJmsMessage=false">
<to uri="bean:filehandler">
</route>
The exchange.getBody().getClass() returns ActiveMQMessage
i don't understand this behaviour. Why does the actual class get lost?
--
View this message in context: http://old.nabble.com/Recieving-BlobMessages-routed-with-Camel-tp28367084p28476460.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Recieving BlobMessages routed with Camel
Posted by sheckey <vo...@gmail.com>.
Hi,
please ignore my previous post. Simple conversion to HornetQObjectMessage
did the trick.
Regards
--
View this message in context: http://camel.465427.n5.nabble.com/Recieving-BlobMessages-routed-with-Camel-tp471389p5754035.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Recieving BlobMessages routed with Camel
Posted by sheckey <vo...@gmail.com>.
Hi Claus,
I was looking for similar topic on HornetQ but couldn't find it.
I am having route like this:
from("jms:IncomingMessages?mapJmsMessage=false").beanRef(bean,
"methodName");
My method implementation looks lilke:
public String methodName(@Body Object message) {
final org.hornetq.jms.client.HornetQMessage hqmessage =
(org.hornetq.jms.client.HornetQMessage) message;
final ClientMessage cliMessage = receivedNotification.getCoreMessage();
if I check cliMessage.getBodySize() I always get 0. Other parameters like
message id, priority etc are available but I am just having problems getting
the original message that I could convert to object that I expect.
At the sender side I am sending javax.jms.ObjectMessage that contains my
serializable objects.
Is this the proper way to do this, or am I missing out something here.
I was browsing as much as I could not to duplicate an existing issue, sorry
if this was already asked.
Regards
--
View this message in context: http://camel.465427.n5.nabble.com/Recieving-BlobMessages-routed-with-Camel-tp471389p5754034.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Recieving BlobMessages routed with Camel
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You most likely need to not map the message automatic, eg mapJmsMessage=false
And then you may be able to grab that ActiveMQBlobMessage message.
On Mon, Apr 26, 2010 at 6:26 PM, GibKing <gi...@byteholder.de> wrote:
>
> Hi everyone,
>
> i like to send files over ActiveMQ using the following setup.
>
> Code snippet to send the file:
> BlobMessage message = session.createBlobMessage(inputStream);
> message.setJMSType("Filetransfer");
> message.setStringProperty("Filename", filename);
> ActiveMQQueue queue = (ActiveMQQueue) session.createQueue("filequeue");
> MessageProducer producer = session.createProducer(queue);
> producer.send(message);
>
> Camel Configuration snippet: (camel.xml)
> <route>
> <from uri="activemq:filequeue">
> <to uri="bean:filehandler">
> </route>
> <!-- beanconfiguration.... -->
>
> An finally the filehandler:
> public class FileHandler{
> @Handler
> public void onMessage(Exchange exchange){
> ....
> }
>
> My question is how i can get an ActiveMQBlobMessage (or the InputStream)
> inside my filehandler.
> Is this possible after all?
>
> greets
> GibKing
>
>
> --
> View this message in context: http://old.nabble.com/Recieving-BlobMessages-routed-with-Camel-tp28367084p28367084.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.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