/// <summary> /// SEnds a message to Service Bus topic. /// </summary> /// <param name="msg"></param> /// <param name="args">topicPath, subscriptionName.</param> public void Send(Message msg, Dictionary <string, object> args = null) { string TopicName = args["TopicName"].ToString(); string ConnStr = args["ConnStr"].ToString(); TopicClient client = TopicClient.CreateFromConnectionString(ConnStr, TopicName); client.Send(MsgConvertor.FromMessage(msg)); }
public void Send(Message msg, Dictionary <string, object> args = null) { string m_QueueName = args["QueueName"].ToString(); string m_ConnStr = args["ConnStr"].ToString(); QueueClient client = QueueClient.CreateFromConnectionString(m_ConnStr, m_QueueName); client.Send(MsgConvertor.FromMessage(msg)); }
public Message Receive(Dictionary <string, object> args = null) { string m_QueueName = args["QueueName"].ToString(); string m_ConnStr = args["ConnStr"].ToString(); Message msg = new Message(); QueueClient client = QueueClient.CreateFromConnectionString(m_ConnStr, m_QueueName, ReceiveMode.ReceiveAndDelete); var sbMsg = client.Receive(TimeSpan.FromMinutes(2)); msg = MsgConvertor.ToMessage(sbMsg); return(msg); //throw new NotImplementedException(); }
/// <summary> /// Receieves the message from Service Bus Subscription /// </summary> /// <param name="args">topicPath, subscriptionName, ReceiveMode.</param> /// <returns></returns> public Message Receive(Dictionary <string, object> args = null) { string TopicName = args["TopicName"].ToString(); string ConnStr = args["ConnStr"].ToString(); string SubscriptionName = args["SubscriptionName"].ToString(); Message msg = new Message(); msg = null; SubscriptionClient client = SubscriptionClient.CreateFromConnectionString(ConnStr, TopicName, SubscriptionName, ReceiveMode.ReceiveAndDelete); var sbMsg = client.Receive(TimeSpan.FromSeconds(2)); if (sbMsg != null) { msg = MsgConvertor.ToMessage(sbMsg); } return(msg); }