You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by gfshaikh <gh...@taxware.com> on 2013/01/04 09:17:21 UTC

Sending Meta Data over Active MQ Channel(for Stream Messages)

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.

RE: Reply:RE: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by gfshaikh <gh...@taxware.com>.
Do you have some sample code - I sent you a copy of what I am using

From: SuoNayi [via ActiveMQ] [mailto:ml-node+s2283324n4661340h51@n4.nabble.com]
Sent: Friday, January 04, 2013 8:43 AM
To: Shaikh-Contractor, Ghulam (CORP)
Subject: Reply:RE: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Strange, I have just written a test case to obtain the properties via call on that method and it works fine.
I can recall that Christian has done the test as well.


At 2013-01-04 21:30:08,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661340&i=0>> wrote:

>ActiveMQ  5.7
>
>From: SuoNayi [via ActiveMQ] [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4661340&i=1>]
>Sent: Friday, January 04, 2013 8:29 AM
>To: Shaikh-Contractor, Ghulam (CORP)
>Subject: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)
>
>Can you tell what version you're using?
>
>
>
>
>At 2013-01-04 21:26:20,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=0>> wrote:
>
>>Hi - Thanks for responding I tried that but it didn't work. Any other way to get the properties ?
>>
>>From: SuoNayi [via ActiveMQ] [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=1>]
>>Sent: Friday, January 04, 2013 8:25 AM
>>To: Shaikh-Contractor, Ghulam (CORP)
>>Subject: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)
>>
>>Hi, you have posted the issue some days ago, here is the link:
>>http://activemq.2283324.n4.nabble.com/ActiveMQ-Stream-Messaging-amp-JMS-Properties-td4661193.html
>>I believe you can obtain the properties that carrying the meta data via call on the getJMSProperties method
>>of ActiveMQInputStream.
>>You may see the jira:
>>https://issues.apache.org/jira/browse/AMQ-4241
>>
>>
>>
>>At 2013-01-04 16:17:21,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661335&i=0>> 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.
>>
>>________________________________
>>If you reply to this email, your message will be added to the discussion below:
>>
>>NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>>----------------------------------------------------------------------
>>This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  [hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=2>  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.
>>
>>
>>
>>
>>--
>>View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661336.html
>>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>________________________________
>If you reply to this email, your message will be added to the discussion below:
>
>NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>----------------------------------------------------------------------
>This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  [hidden email]</user/SendEmail.jtp?type=node&node=4661340&i=2>  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.
>
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661339.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

________________________________
If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661340.html
To unsubscribe from Sending Meta Data over Active MQ Channel(for Stream Messages), click here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4661318&code=Z2h1bGFtLnNoYWlraEB0YXh3YXJlLmNvbXw0NjYxMzE4fDE3NjE5NDcwMDU=>.
NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

----------------------------------------------------------------------
This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  Ghulam.Shaikh@taxware.com  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661341.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply:RE: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by SuoNayi <su...@163.com>.
Strange, I have just written a test case to obtain the properties via call on that method and it works fine.
I can recall that Christian has done the test as well.


At 2013-01-04 21:30:08,gfshaikh <gh...@taxware.com> wrote:
>ActiveMQ  5.7
>
>From: SuoNayi [via ActiveMQ] [mailto:ml-node+s2283324n4661338h89@n4.nabble.com]
>Sent: Friday, January 04, 2013 8:29 AM
>To: Shaikh-Contractor, Ghulam (CORP)
>Subject: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)
>
>Can you tell what version you're using?
>
>
>
>
>At 2013-01-04 21:26:20,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=0>> wrote:
>
>>Hi - Thanks for responding I tried that but it didn't work. Any other way to get the properties ?
>>
>>From: SuoNayi [via ActiveMQ] [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=1>]
>>Sent: Friday, January 04, 2013 8:25 AM
>>To: Shaikh-Contractor, Ghulam (CORP)
>>Subject: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)
>>
>>Hi, you have posted the issue some days ago, here is the link:
>>http://activemq.2283324.n4.nabble.com/ActiveMQ-Stream-Messaging-amp-JMS-Properties-td4661193.html
>>I believe you can obtain the properties that carrying the meta data via call on the getJMSProperties method
>>of ActiveMQInputStream.
>>You may see the jira:
>>https://issues.apache.org/jira/browse/AMQ-4241
>>
>>
>>
>>At 2013-01-04 16:17:21,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661335&i=0>> 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.
>>
>>________________________________
>>If you reply to this email, your message will be added to the discussion below:
>>
>>NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>>----------------------------------------------------------------------
>>This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  [hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=2>  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.
>>
>>
>>
>>
>>--
>>View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661336.html
>>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>________________________________
>If you reply to this email, your message will be added to the discussion below:
>http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661338.html
>To unsubscribe from Sending Meta Data over Active MQ Channel(for Stream Messages), click here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4661318&code=Z2h1bGFtLnNoYWlraEB0YXh3YXJlLmNvbXw0NjYxMzE4fDE3NjE5NDcwMDU=>.
>NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>----------------------------------------------------------------------
>This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  Ghulam.Shaikh@taxware.com  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.
>
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661339.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

RE: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by gfshaikh <gh...@taxware.com>.
ActiveMQ  5.7

From: SuoNayi [via ActiveMQ] [mailto:ml-node+s2283324n4661338h89@n4.nabble.com]
Sent: Friday, January 04, 2013 8:29 AM
To: Shaikh-Contractor, Ghulam (CORP)
Subject: Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Can you tell what version you're using?




At 2013-01-04 21:26:20,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=0>> wrote:

>Hi - Thanks for responding I tried that but it didn't work. Any other way to get the properties ?
>
>From: SuoNayi [via ActiveMQ] [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=1>]
>Sent: Friday, January 04, 2013 8:25 AM
>To: Shaikh-Contractor, Ghulam (CORP)
>Subject: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)
>
>Hi, you have posted the issue some days ago, here is the link:
>http://activemq.2283324.n4.nabble.com/ActiveMQ-Stream-Messaging-amp-JMS-Properties-td4661193.html
>I believe you can obtain the properties that carrying the meta data via call on the getJMSProperties method
>of ActiveMQInputStream.
>You may see the jira:
>https://issues.apache.org/jira/browse/AMQ-4241
>
>
>
>At 2013-01-04 16:17:21,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661335&i=0>> 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.
>
>________________________________
>If you reply to this email, your message will be added to the discussion below:
>
>NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>----------------------------------------------------------------------
>This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  [hidden email]</user/SendEmail.jtp?type=node&node=4661338&i=2>  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.
>
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661336.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

________________________________
If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661338.html
To unsubscribe from Sending Meta Data over Active MQ Channel(for Stream Messages), click here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4661318&code=Z2h1bGFtLnNoYWlraEB0YXh3YXJlLmNvbXw0NjYxMzE4fDE3NjE5NDcwMDU=>.
NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

----------------------------------------------------------------------
This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  Ghulam.Shaikh@taxware.com  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661339.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply:RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by SuoNayi <su...@163.com>.
Can you tell what version you're using?




At 2013-01-04 21:26:20,gfshaikh <gh...@taxware.com> wrote:
>Hi - Thanks for responding I tried that but it didn't work. Any other way to get the properties ?
>
>From: SuoNayi [via ActiveMQ] [mailto:ml-node+s2283324n4661335h96@n4.nabble.com]
>Sent: Friday, January 04, 2013 8:25 AM
>To: Shaikh-Contractor, Ghulam (CORP)
>Subject: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)
>
>Hi, you have posted the issue some days ago, here is the link:
>http://activemq.2283324.n4.nabble.com/ActiveMQ-Stream-Messaging-amp-JMS-Properties-td4661193.html
>I believe you can obtain the properties that carrying the meta data via call on the getJMSProperties method
>of ActiveMQInputStream.
>You may see the jira:
>https://issues.apache.org/jira/browse/AMQ-4241
>
>
>
>At 2013-01-04 16:17:21,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661335&i=0>> 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.
>
>________________________________
>If you reply to this email, your message will be added to the discussion below:
>http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661335.html
>To unsubscribe from Sending Meta Data over Active MQ Channel(for Stream Messages), click here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4661318&code=Z2h1bGFtLnNoYWlraEB0YXh3YXJlLmNvbXw0NjYxMzE4fDE3NjE5NDcwMDU=>.
>NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>----------------------------------------------------------------------
>This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  Ghulam.Shaikh@taxware.com  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.
>
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661336.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

RE: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by gfshaikh <gh...@taxware.com>.
Hi - Thanks for responding I tried that but it didn't work. Any other way to get the properties ?

From: SuoNayi [via ActiveMQ] [mailto:ml-node+s2283324n4661335h96@n4.nabble.com]
Sent: Friday, January 04, 2013 8:25 AM
To: Shaikh-Contractor, Ghulam (CORP)
Subject: Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Hi, you have posted the issue some days ago, here is the link:
http://activemq.2283324.n4.nabble.com/ActiveMQ-Stream-Messaging-amp-JMS-Properties-td4661193.html
I believe you can obtain the properties that carrying the meta data via call on the getJMSProperties method
of ActiveMQInputStream.
You may see the jira:
https://issues.apache.org/jira/browse/AMQ-4241



At 2013-01-04 16:17:21,gfshaikh <[hidden email]</user/SendEmail.jtp?type=node&node=4661335&i=0>> 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.

________________________________
If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661335.html
To unsubscribe from Sending Meta Data over Active MQ Channel(for Stream Messages), click here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4661318&code=Z2h1bGFtLnNoYWlraEB0YXh3YXJlLmNvbXw0NjYxMzE4fDE3NjE5NDcwMDU=>.
NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

----------------------------------------------------------------------
This message and any attachments thereto contain information that may be privileged, confidential or otherwise protected from disclosure and is the property of Taxware, LLC. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message, any attachments thereto or any part thereof. If you receive this message in error, please notify me at  Ghulam.Shaikh@taxware.com  and delete all copies of this message and attachments. Taxware, LLC. has implemented anti-virus software on its computers and servers, however, it is the recipient's own responsibility to ensure that all attachments are scanned for viruses prior to usage.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Sending-Meta-Data-over-Active-MQ-Channel-for-Stream-Messages-tp4661318p4661336.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply:Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by SuoNayi <su...@163.com>.
Hi, you have posted the issue some days ago, here is the link:
http://activemq.2283324.n4.nabble.com/ActiveMQ-Stream-Messaging-amp-JMS-Properties-td4661193.html
I believe you can obtain the properties that carrying the meta data via call on the getJMSProperties method 
of ActiveMQInputStream.
You may see the jira: 
https://issues.apache.org/jira/browse/AMQ-4241



At 2013-01-04 16:17:21,gfshaikh <gh...@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.

Re: Sending Meta Data over Active MQ Channel(for Stream Messages)

Posted by Gary Tully <ga...@gmail.com>.
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 <gh...@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