Message Bus Adapter

maikelj
Member Posts: 50
Hi there, I've got the following problem:
What must I do to get a connection with a MS Queue Server?
With the following code I always get an error:
OnRun()
...
...
CREATE(MQBus);
CREATE(CC2);
MQBus.OpenReceiveQueue('MyMessageQueueServer\comcom2_queue',0,0);
CC2.AddBusAdapter(MQBus,1);
...
...
The error occurs on the line with the smiley.
Who can help me.
MaikelJ
What must I do to get a connection with a MS Queue Server?
With the following code I always get an error:
OnRun()
...
...
CREATE(MQBus);
CREATE(CC2);
MQBus.OpenReceiveQueue('MyMessageQueueServer\comcom2_queue',0,0);

CC2.AddBusAdapter(MQBus,1);
...
...
The error occurs on the line with the smiley.
Who can help me.
MaikelJ
0
Comments
-
I've used the same code and it works well; which kind of error do you receive ?
Try to invert the last 2 lines: first AddBusAdapter and then OpenReceiveQueue.
Andrea0 -
I must first install MMQS before doing anything else.
The only problem is how to do this?
MaikelJ0 -
MSMQ is a part of Win2000 OS.
Go to Control PAnel, Add/Remove Programs, Add/Remove Windows Components, then scroll down to 'Message Queuing Services' and chek it.
That's it.
Andrea0 -
Hi Andrea,
I've checked the 'Message Queuing Services' and the service is started.
So far so good.
And then when I just the code with line 'MQBus.OpenReceiveQueue('MyMessageQueueServer\comcom2_queue',0,0');' I get the following error: The call to member OpenReceiveQueue falied.MSMQQueueInfo returned the following message: The remote computer is not available.
Then I used the line 'MQBus.OpenReceiveQueue(MyMessageQueueServer\MyQueue\comcom2_queue',0,0');' I get the following error: The call to member OpenReceiveQueue falied.MSMQQueueInfo returned the following message: An invalid parameter was passed to a function.
What am I doing wrong??? :shock:
MaikelJ0 -
What kind of Queue did you create? I defined a Private Queue on a Win2000 server (not a Domain Controller).
The correct code is the first you mentioned, but instead of 'comcom2_queue' you have to use you queue path (i have a setup table where I define this path as '\\server_name\queue').
Andrea0 -
Sorry I ask Andrea, but how can I create such a queue? :oops:
MaikelJ0 -
Administrative Tools --> Computer Management --> expand Services and Applications --> Message Queuing --> right click on Private Queues --> New --> Private Queue.
Be sure to check the Security settings in the Properties of your queue.
Andrea0 -
The part with the queue works, but I've got another question.
I have a document with an example how to receive a message and send a reply.
The code is as followed:
CC2::MessageReceived(VAR InMessage:Automation)
InMsg := InMessage;
IF (InMsg.ExpectReply) THEN
BEGIN
InS := InMsg.GetStream();
InS.READ(Txt);
MESSAGE(Txt);
OutMsg := InMsg.CreateReply();
OutS := OutMsg.GetStream();
OutS.WRITE('blablabla');
OutMsg.Send(0);
END;
InMsg.CommitMessage();
My questions are:
How can I create such a function?
Because when I create a function with the name CC2, NA says it already exists with such a name.
Is this the only function I need, or must I create another function before I can run CC2::MessageReceived.
MaikelJ0 -
You don't have to create a new function; you have to change a property of the CC2 automation object:
WithEvents --> YES
and the function CC2::MessageReceived is created
by the way, where is Asenray ??
Andrea0 -
Andrea, I've changed the property WithEvents to Yes,
But when I run the Codeunit it only processes the OnRun() trigger.
It doesn't processes the function CC2::MessageReceived.
Asenray is a place in the south of the Netherlands.
Near a city called Roermond (near the german border).
MaikelJ0 -
The function CC2::MessageReceived is processed whenever a message arrives into the queue. Check the queue to see if messages do arrive:
Administrative Tools --> Computer Management --> expand Services and Applications --> Message Queuing --> Private Queues --> 'your queue' --> Queue Messages
when the message arrives you should be able to see it, otherwise you have to investigate why no message is posted.
Andrea0 -
Hi!
I too are trying to set up a message queue poller. I have managed to get it running in a form, but with NAS, the message queue never gets polled.
I tried "debuggin" using MESSAGE() to write to the event log when the eventhandler triggered, but it never did.
Should I set up some sort of a timer to keep the codeunit running?
/Kirne/ Kirne0 -
Hi Kirne,
there is no timer to keep a codeunit running. In order to obtain this you have to set the property SINGLEINSTANCE of the codeunit to TRUE. This makes the CU running till you close the client or open another company.0 -
That works for cphanlder.dll !
But any other dll trying to run as a service ignores this as well...
Has anyone succeeded in running their own service in NAS?/ Kirne0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions