Beispiel #1
0
void QpidPB_Listener_T <CONSUMER_T, EVENT>::
received (qpid::client::Message & message)
{
  // Read the protobuf event
  this->pb_event_.ParseFromString (message.getData ());

  // Wrap the received event in the generated upcall type
  upcall_event_type ev (this->pb_event_);

  // Pass the wrapped event to the consumer
  this->consumer_->push_event (&ev);
}
void msg_receiver(qpid::client::Message& msg) {
  LOG_INFO("Message received: size:[%d]", msg.getData().length());
  msgpack::sbuffer sbuf;
  sbuf.write(msg.getData().c_str(), msg.getData().length());
  proto_data_interface pbuf;
  try {
    msgpack_util<proto_data_interface>::decode(sbuf, pbuf);
  }catch(std::exception& ex) {
	  LOG_ERROR("Failed to decode the message for proto_data_interface");
  }


  if(pbuf.protocol() == msg::PROTO_SMPP) {
	  smpp_message_req smppdata;
	  try {
	    msgpack_util<smpp_message_req>::decode(sbuf, smppdata);
	    LOG_INFO("from[%s], address[%s], msg[%s]",
	    		smppdata.from_.address_.c_str(), smppdata.to_list_.front().address_.c_str(),
	    		smppdata.msg_.c_str());
	  }catch(std::exception& ex) {
		  LOG_ERROR("Failed to decode the message for smpp_message_req");
	  }
 }
}