not able to receive a .txt file from a message queue (MSMQ)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thajudeen
    New Member
    • Nov 2009
    • 1

    not able to receive a .txt file from a message queue (MSMQ)

    Hi ,

    I am able to send a text file (.txt) to a message queue (MSMQ).
    But i am not able to receive the .txt file from the message queue. Please help how to proceed.

    I am Using BodyStream property to send the content of the text file. In the message queue am able to see the content data present. I think by default MSMQ uses xmlformatter.

    Below is code for sending i have used
    -------------------------------------------------------
    System.Messagin g.Message mm = new System.Messagin g.Message();
    string path = @"EDID93ADES.tx t";
    System.IO.FileS tream stream = new System.IO.FileS tream(path, System.IO.FileM ode.Open);
    mm.BodyStream = stream;
    mm.Label = System.IO.Path. GetFileName(pat h);
    mm.Priority = MessagePriority .Normal;
    mq.Send(mm);

    for Receiving the code i have used
    -------------------------------------------------

    System.Messagin g.Message mes;
    string m;
    mq1 = new System.Messagin g.MessageQueue( @".\Private$\My Queue");
    try
    {

    mes = mq1.Receive(new TimeSpan(0, 0, 3));
    mes.Formatter = new XmlMessageForma tter(new String[] { "System.String, mscorlib" });
    m = mes.Body.ToStri ng();


    }
    catch
    {
    m = "No Message";
    }

    Please help out of this...

    It will be a great help full

    Thanks,
    Thaj
Working...