473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Remote journal problem - MessageQueue

Hi all. I'm writing a queue browser that reads queues from a specified
machine and then display the data that's on the queue. I am using the
MessageQueue Class in .Net(C#).

I get the problem that I can't read the journal private queue on a remote
machine. I don't know if this is possible though. I have tried all the
possible options but can't seem to get it to work. The code that I tried is:

MessageQueue _mq = new MessageQueue( "FormatName:DIRECT=OS:" +
"RemoteMachine\private$\icsis_el_queue\JOURNAL $);

Any help will be appreciated.

Thanks in advance
Nov 15 '05 #1
3 5068
you can only access a remote machine's public queues.
private queues are for messages sent internally on a machine.

Dan.

"Gerhard Swart" <te********@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all. I'm writing a queue browser that reads queues from a specified
machine and then display the data that's on the queue. I am using the
MessageQueue Class in .Net(C#).

I get the problem that I can't read the journal private queue on a remote
machine. I don't know if this is possible though. I have tried all the
possible options but can't seem to get it to work. The code that I tried is:

MessageQueue _mq = new MessageQueue( "FormatName:DIRECT=OS:" +
"RemoteMachine\private$\icsis_el_queue\JOURNAL $);

Any help will be appreciated.

Thanks in advance

Nov 15 '05 #2
Thanks Daniel,

Since I'm a bit new to .Net I'm still learning all the nitty gritties.
In one of my previous applications I wrote using MSMQ2 COM component(VB6),
the application picked up the remote private journal. Was the application
suppose to
be able to do that, because if not then I would maybe have to make some
changes to the app.
Do you maybe know why the MSMQ functionality differ from the MessageQueue
functionality?

Thanks in advance

"Daniel Bass" <I'm really @ sick of spam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
you can only access a remote machine's public queues.
private queues are for messages sent internally on a machine.

Dan.

"Gerhard Swart" <te********@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all. I'm writing a queue browser that reads queues from a specified
machine and then display the data that's on the queue. I am using the
MessageQueue Class in .Net(C#).

I get the problem that I can't read the journal private queue on a remote
machine. I don't know if this is possible though. I have tried all the
possible options but can't seem to get it to work. The code that I tried is:
MessageQueue _mq = new MessageQueue( "FormatName:DIRECT=OS:" +
"RemoteMachine\private$\icsis_el_queue\JOURNAL $);

Any help will be appreciated.

Thanks in advance

Nov 15 '05 #3
MSDN's definitions:

private queue
A queue registered on the local computer (not in the directory service) that
typically cannot be located by other applications. Private queues have the
advantage of no directory service overhead (faster to create, no latency,
and no replication), and they can be created and deleted when the directory
service is not working.

public queue
A queue registered in the directory service that can be located by any
Message Queuing application. Public queues are persistent and their
registration information can be backed up on the enterprise, making them
good for long-term use.

From this I deduced that the queues that are private are only accessed by
the application that created them?

I don't think you should specify the "private" sub path name when accessing
a queue reading or writing...

I've created a wrapper for reading and writing synchronously if you'd like
to have a look.
I've changed the example, and removed a few references to the rest of the
app in which it resided.

************************************************** *****************
using System;
using System.Windows.Forms;
using System.Messaging;
using System.IO;
using System.Threading;

namespace BIF_Queues
{
/// <summary>
/// InterfaceTypeMSMQ handles the message queues for MSMQ (version 2/3).
/// </summary>
public class MSMQWrapper
{
//
// Thread Safe Wrapper...
//

//
// member variables
//

private MessageQueue m_Queue;
private bool m_bValid = false;
public Valid
{
get
{
return m_bValid;
}
}
//
// constructor
//

public MSMQWrapper(string szServer, string szAddress)
{
string szQueuePath = szServer + "\\" + szAddress;
try
{

if ( !MessageQueue.Exists( szQueuePath ) )
{
if ( MessageBox.Show("The path you specified for a
queue, '" + szQueuePath +"' does not exists. Do you wish to create it? (
Pressing 'No' disregard this queue ).", "MSMQ Queue not found!",
MessageBoxButtons.YesNo ) == DialogResult.Yes )
{
m_Queue = MessageQueue.Create(szQueuePath);
m_bValid = true;
}
}
else
{
m_Queue = new MessageQueue(szQueuePath);
m_bValid = true;
}

m_szAddress = szQueuePath;
}
catch ( Exception ex )
{
DebugLog.Instance().WriteLog( "InterfaceTypeMSMQ [" +
szQueuePath + "] :- Exception Error. " + ex.Message );
}
}
//
// overridden methods
//

public override eResult Send( string data )
{
m_Queue.Send(data);
return eResult.RES_SUCCESS;
}

public override void Receive( out string data )
{
data = "";
while (Global.Instance().Listening)
{
try
{
System.Messaging.Message msg = m_Queue.Receive(new
TimeSpan(0,0,0,0,500)); // throws an exception if the method times out

// message was received, strip out the padded XML,
should it exist
string szBuffer = Global.Instance().StreamToString(
msg.BodyStream );
szBuffer = szBuffer.Replace("<?xml
version=\"1.0\"?>\r\n<string>", "");
szBuffer = szBuffer.Replace("</string>", "");
szBuffer = szBuffer.Replace("&lt;","<");
szBuffer = szBuffer.Replace("&gt;",">");

// stick it back into a buffer
data = szBuffer;
return;
}
catch ( Exception )
{
// wait a litte, and carry on, all the exception
// means is no message was found no the queue.
Thread.Sleep(1000);
}
}

return;
}

}
}
************************************************** *********************

so all you'd need to do is something like this:

MSMQWrapper myQueue = new MSMQWrapper ( "myComputer", "remoteQueue" );
myQueue.Send ("Test Data");
String receivedData;
myQueue.Receive( receivedData );

Although it's synchronous, you can use it in multithreaded instances, so
that one thread would have the task of simply looking at a queue for data,
and processing that data it downloaded, while the rest of the program got on
and did something else.

Hope that helps.
Dan.

************************************************** *********************
"Gerhard Swart" <te********@microsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks Daniel,

Since I'm a bit new to .Net I'm still learning all the nitty gritties.
In one of my previous applications I wrote using MSMQ2 COM component(VB6),
the application picked up the remote private journal. Was the application
suppose to
be able to do that, because if not then I would maybe have to make some
changes to the app.
Do you maybe know why the MSMQ functionality differ from the MessageQueue
functionality?

Thanks in advance

"Daniel Bass" <I'm really @ sick of spam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
you can only access a remote machine's public queues.
private queues are for messages sent internally on a machine.

Dan.

"Gerhard Swart" <te********@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all. I'm writing a queue browser that reads queues from a specified
machine and then display the data that's on the queue. I am using the
MessageQueue Class in .Net(C#).

I get the problem that I can't read the journal private queue on a remote
machine. I don't know if this is possible though. I have tried all the
possible options but can't seem to get it to work. The code that I tried is:
MessageQueue _mq = new MessageQueue( "FormatName:DIRECT=OS:" +
"RemoteMachine\private$\icsis_el_queue\JOURNAL $);

Any help will be appreciated.

Thanks in advance

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Anibal David Acosta F. | last post by:
I want to access to MessageQueue from a remote machine, the path ".\private$\myQueue" only works locally, and the path "\\myServer\private$\myQueue" doesn't works. Do you know how can I access?...
6
by: deepak | last post by:
I have to create message queue at remote machin. My code works properly when i use console application in c#. But it throws exception whenever i try it on web application in c#. My code is ...
4
by: Ash | last post by:
Is there a built in classes in .NET to make it easy to read/write MSMQ messages to/from remote queues? If not then what is the best way to implement it?
0
by: Marcus | last post by:
Hello All, I am trying to create a private MSMQ message queue on a remote application server from an asp.net application using the following code: Dim queue As MessageQueue queue =...
5
by: felecha | last post by:
I have a VB.Net application that runs as a Windows Service and monitors a MessageQueue on another machine. At times that machine will have to be rebooted, so I've been working on how to get my...
2
by: felecha | last post by:
I'm stumped. I'm working on an application in VB.Net that uses System.Messaging.MessageQueue to listen for messages sent to a private queue on a remote machine. Both machines are in the same...
4
by: Risen | last post by:
Hi,All, I read MSDN about MessageQueue,and then I want to write some code to test MessageQueue in Vb.Net 2003. But there are some errors in code,and I don't know which code are incorrect. Who...
3
by: Telem | last post by:
I would like to know how to access to a machine using username and password using C# tnk
0
by: chi.chung.ko | last post by:
Dear Pals local:Windows XP Sp2 server:Windows 2K3 Sever R2 When Use to Receive MessageQueue On Server System.Messaging.MessageQueue IQ = new MessageQueue(); IQ.Path =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.