void LongPollingMessageReceiver::processReceivedJsonObjects(const std::string& jsonObject) { JoynrMessage* msg = JsonSerializer::deserialize<JoynrMessage>(jsonObject); if (msg == nullptr) { JOYNR_LOG_ERROR(logger, "Unable to deserialize message. Raw message: {}", jsonObject); return; } if (msg->getType().empty()) { JOYNR_LOG_ERROR(logger, "received empty message - dropping Messages"); return; } if (!msg->containsHeaderExpiryDate()) { JOYNR_LOG_ERROR(logger, "received message [msgId=[{}] without decay time - dropping message", msg->getHeaderMessageId()); } if (msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST || msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST || msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_BROADCAST_SUBSCRIPTION_REQUEST) { // TODO ca: check if replyTo header info is available? std::string replyChannelId = msg->getHeaderReplyChannelId(); std::shared_ptr<system::RoutingTypes::ChannelAddress> address( new system::RoutingTypes::ChannelAddress(replyChannelId)); messageRouter->addNextHop(msg->getHeaderFrom(), address); } // messageRouter.route passes the message reference to the MessageRunnable, which copies it. // TODO would be nicer if the pointer would be passed to messageRouter, on to MessageRunnable, // and runnable should delete it. messageRouter->route(*msg); delete msg; }
void DbusMessagingStubAdapter::transmit(JoynrMessage& message) { logMethodCall(QString("transmit message with ID: %1 and payload: %2") .arg(message.getHeaderMessageId()) .arg(QString(message.getPayload()))); // copy joynr message joynr::messaging::IMessaging::JoynrMessage dbusMsg; DbusMessagingUtil::copyJoynrMsgToDbusMsg(message, dbusMsg); // call CommonAPI::CallStatus status; proxy->transmit(dbusMsg, status); // print the status printCallStatus(status, "transmit"); }