adding the meta data via a property should be the answer, have a peek at https://issues.apache.org/jira/browse/AMQ-2988
there is a test included with the patch: org.apache.activemq.streams.JMSInputStreamTest#testStreamsWithProperties On 4 January 2013 08:17, gfshaikh <ghulam.sha...@taxware.com> wrote: > Hi All > > I am trying to figure out this issue for a POC we are doing with ActiveMQ. > We are using Output and InputStreams to copy files across from producer to > consumer. The files get copied acrosss correctly however we also need to > pass some meta data in the form of file names so that the file can be named > correctly at the recepient end. > > The following is some sample code which I am using, appreciate some > feedback > if someone has a working solution for this issue. > > Sender > ------- > FileInputStream in = new FileInputStream( > "C:\\Temp\\FileName.txt"); > > String brokerURI = ActiveMQConnectionFactory.DEFAULT_BROKER_URL; > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory( > brokerURI); > ActiveMQConnection connection = (ActiveMQConnection) connectionFactory > .createConnection(); > connection.start(); > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > Queue destination = session.createQueue(QUEUE_NAME); > > Map myMap = new HashMap(); > myMap.put("invocation", "invocation"); > ActiveMQOutputStream out = > (ActiveMQOutputStream)connection.createOutputStream(destination, myMap, > ActiveMQMessage.DEFAULT_DELIVERY_MODE, ActiveMQMessage.DEFAULT_PRIORITY, > ActiveMQMessage.DEFAULT_TIME_TO_LIVE); > // now write the file on to ActiveMQ > byte[] buffer = new byte[1024]; > while (true) > { > int bytesRead = in.read(buffer); > if (bytesRead == -1) > { > break; > } > out.write(buffer, 0, bytesRead); > } > out.close(); > > Receiver > --------- > String brokerURI = ActiveMQConnectionFactory.DEFAULT_BROKER_URL; > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory( > brokerURI); > ActiveMQConnection connection = (ActiveMQConnection) connectionFactory > .createConnection(); > connection.start(); > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > // we want be be an exclusive consumer > String exclusiveQueueName = QUEUE_NAME + "?consumer.exclusive=true"; > Queue destination = session.createQueue(exclusiveQueueName); > InputStream in = connection.createInputStream(destination); > String myString = IOUtils.toString(in); > FileOutputStream out = new FileOutputStream( > "C:\\Temp\\NeedTargetFileName.txt"); > out.write(myString.getBytes()); > > Thanks > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > -- http://redhat.com http://blog.garytully.com