I have solved this problem for the time being. I first created a new message in parallel in C++, named BlobMessageLi, which is exactly the same as the original TextMessage, but just BlobMessageLi the name is different. My BlobMessageLi is not the same as the original BlobMessage, but it is the same as the original TextMessage. Then, I replace the message inside the TypeId, ID_ACTIVEMQBLOBMESSAGELI = 29, and ID_ACTIVEMQBLOBMESSAGE = 41; At this point, the setStringProperty sent in C++ can be received normally in JAVA using the getStringProperty. Then, I modify the original TextMessage getText and setText in parallel to getRemoteBlobUrl and setRemoteBlobUrl. Then, I add info->getRemoteBlobUrl () and info->setRemoteBlobUrl () in multiple places in ActiveMQBlobMessageLiMarshaller.cpp. Here test, in C++, message>setRemoteBlobUrl ("http://192.168.2.227:8161/fileserver/ID_WWW-5DAA99645BA-3700-1494653738046-1_1_1_1_1"); In JAVA, you can normally open read ActiveMQBlobMessage.getRemoteBlobUrl () and blobMessage.getInputStream (); This is to have a premise that the file should be in the server. At C++, I can upload files in other ways, return a URL, and then message->setRemoteBlobUrl (myURL) in C++; This basically simulates the expected BlobMessage, but my manager says it's not safe to say it's unsafe. =================================== /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
#include <activemq/wireformat/openwire/marshal/generated/ActiveMQBlobMessageLiMarshaller.h> #include <activemq/commands/ActiveMQBlobMessageLi.h> #include <activemq/exceptions/ActiveMQException.h> #include <decaf/lang/Pointer.h> // // NOTE!: This file is autogenerated - do not modify! // if you need to make a change, please see the Java Classes in the // activemq-core module // using namespace std; using namespace activemq; using namespace activemq::exceptions; using namespace activemq::commands; using namespace activemq::wireformat; using namespace activemq::wireformat::openwire; using namespace activemq::wireformat::openwire::marshal; using namespace activemq::wireformat::openwire::utils; using namespace activemq::wireformat::openwire::marshal::generated; using namespace decaf; using namespace decaf::io; using namespace decaf::lang; /////////////////////////////////////////////////////////////////////////////// DataStructure* ActiveMQBlobMessageLiMarshaller::createObject() const { return new ActiveMQBlobMessageLi(); } /////////////////////////////////////////////////////////////////////////////// unsigned char ActiveMQBlobMessageLiMarshaller::getDataStructureType() const { return ActiveMQBlobMessageLi::ID_ACTIVEMQBLOBMESSAGELI; } /////////////////////////////////////////////////////////////////////////////// void ActiveMQBlobMessageLiMarshaller::tightUnmarshal(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn, BooleanStream* bs) { try { MessageMarshaller::tightUnmarshal(wireFormat, dataStructure, dataIn, bs); ActiveMQBlobMessageLi* info = dynamic_cast<ActiveMQBlobMessageLi*>(dataStructure); info->beforeUnmarshal(wireFormat); info->setRemoteBlobUrl(tightUnmarshalString(dataIn, bs)); info->afterUnmarshal( wireFormat ); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// int ActiveMQBlobMessageLiMarshaller::tightMarshal1(OpenWireFormat* wireFormat, DataStructure* dataStructure, BooleanStream* bs) { try { ActiveMQBlobMessageLi* info = dynamic_cast<ActiveMQBlobMessageLi*>(dataStructure); info->beforeMarshal(wireFormat); int rc = MessageMarshaller::tightMarshal1(wireFormat, dataStructure, bs); rc += tightMarshalString1(info->getRemoteBlobUrl(), bs); return rc + 0; } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// void ActiveMQBlobMessageLiMarshaller::tightMarshal2(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut, BooleanStream* bs) { try { MessageMarshaller::tightMarshal2(wireFormat, dataStructure, dataOut, bs ); ActiveMQBlobMessageLi* info = dynamic_cast<ActiveMQBlobMessageLi*>(dataStructure); tightMarshalString2(info->getRemoteBlobUrl(), dataOut, bs); info->afterMarshal(wireFormat); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// void ActiveMQBlobMessageLiMarshaller::looseUnmarshal(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn) { try { MessageMarshaller::looseUnmarshal(wireFormat, dataStructure, dataIn); ActiveMQBlobMessageLi* info = dynamic_cast<ActiveMQBlobMessageLi*>(dataStructure); info->beforeUnmarshal(wireFormat); info->setRemoteBlobUrl(looseUnmarshalString(dataIn)); info->afterUnmarshal(wireFormat); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// void ActiveMQBlobMessageLiMarshaller::looseMarshal(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut) { try { ActiveMQBlobMessageLi* info = dynamic_cast<ActiveMQBlobMessageLi*>(dataStructure); info->beforeMarshal(wireFormat); MessageMarshaller::looseMarshal(wireFormat, dataStructure, dataOut); looseMarshalString(info->getRemoteBlobUrl(), dataOut); info->afterMarshal(wireFormat); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } -- View this message in context: http://activemq.2283324.n4.nabble.com/BlobMessage-in-ActiveMQ-CPP-by-now-2017-tp4726457p4726634.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.