void _cedaSubscribe_OnCedaMessage(com.adaptiveMQ2.message.Message msg) { CedaObject co = CedaObject.ToCedaObject(msg); string str = string.Format("receive a msg,topic={0},MessageBody=\n{1}", co.Topic, co.MessageBody); logHelper.Info(str); }
void btnSend_Click(object sender, EventArgs e) { request = new com.adaptiveMQ2.message.Message(); request.Destination = new Destination(txtTopic.Text.Trim()); request.MessageBody.addString((short)3, txtMsgBody.Text.Trim()); request.MessageBody.addString((short)4, "JSON"); request.MessageBody.addInt((short)5, 0); request.MessageBody.addString(7, DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); if (!_cedaSubscribe.IsConnected) { ConnectionServer(); } _cedaSubscribe.SendMessage(request); logHelper.Info("send a msg,topic: " + request.Destination.getName()); }