activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MathxH <brainf...@foxmail.com>
Subject CMS cannot receive the file content from JMS create BlobMessage contains file content
Date Fri, 06 Nov 2015 06:45:38 GMT
System Enviroment:

1.ActiveMQ broker version is 5.9.1  
2.CMS  version is 3.9.0  ---------------this version support BlobMessage
3.JMS version is 1.1


4. (1)java version is 1.8.0_40
    (2)java TM  SE rumtime enviroment (build 1.8.0_40-b26)
    (3)java HotSpot b4-bit server VM (build 25.40-b25,mixed mode)

***************************************************************

Here is details:

I need to  transfer big files between different language clients (JMS and
CMS) with ActiveMQ,then, the issue comes to show:
    I use JMS create BlobMessage to send it with file.(producer) and use CMS
receive this BlobMessage(consumer) , CMS cannot get the file content.  I am
pretty sure that BlobMessage has sent to broker successfully and CMS can
receive this blobmessage (because I can get related Message Properties from
JMS),BUT!!,    CMS cannot get file Content.

JMS code snippet as follows:
*
        BlobMessage blobMessage = session.createBlobMessage(file);
 
        blobMessage.setStringProperty("FILE.NAME", file.getName());
 
        blobMessage.setLongProperty("FILE.SIZE", file.length());
 
        System.out.println("start send file:" + file.getName() + ",file
size:"
 
                + file.length() + " bytes");
 
        producer.send(blobMessage);
 
        System.out.println("send complete:" + file.getName());
 
        producer.close();
 
        session.close();
 
        connection.close(); 
*

CMS code snippet as follows:
*
void onMessage( const Message* message ) {
 
      commands::ActiveMQBlobMessage* blobMessage =
dynamic_cast<commands::ActiveMQBlobMessage*>(message);

		if (blobMessage)
		{
			commands::Message* cmdMsg = (commands::Message*)blobMessage;
			if (cmdMsg)
			{
				std::vector<unsigned char> properties =
cmdMsg->getMarshalledProperties();
				LIST_PROPERTIES  lstProperties;
				int nErr = ParseProperties(properties, lstProperties);
				if (nErr == 0)
				{
					// get related properties
					getMessageHeader(lstProperties, header, nFileSize);

					
					if (nFileSize > 0)
					{
						// get file content,but  vector fileContent size is always 
zero						
						std::vector<unsigned char> fileContent;
						fileContent = blobMessage->getContent();
					}
				}
			}
		}
    }
*



--
View this message in context: http://activemq.2283324.n4.nabble.com/CMS-cannot-receive-the-file-content-from-JMS-create-BlobMessage-contains-file-content-tp4703724.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message