MessageQueue myMQ;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
myMQ = new MessageQueue(@".\Private$\InteropQueue");
if (myMQ != null && !MessageQueue.Exists(myMQ.Path))
{
myMQ = MessageQueue.Create(@".\Private$\InteropQueue");
}
System.Messaging.Message msg = new System.Messaging.Message();
msg.Body = "Test";
myMQ.Send(msg);
}
MessageQueue mq;
System.Messaging.Message msg;
private void button2_Click(object sender, EventArgs e)
{
mq = new MessageQueue(@".\Private$\InteropQueue");
Type[] types = new Type[1];
types[0] = typeof(String);
mq.Formatter = new XmlMessageFormatter(types);
try
{
// Call receive on queue
msg = mq.Receive(new TimeSpan(0, 0, 100)); // 5 is wait time in seconds
// Assign to variable
MessageBox.Show(msg.Body.ToString());
}
catch( Exception ex)
{
MessageBox.Show(ex.Message);
}
Delta Constructor (Microsoft.AspNet.OData)
-
Delta Constructor Definition Namespace: Microsoft.AspNet.OData
Assembly:Microsoft.AspNet.OData.dll Assembly:Microsoft.AspNetCore.OData.dll
Package:Microsof...
2 years ago
No comments:
Post a Comment