Event handling in MSMQ advice please

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Event handling in MSMQ advice please

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:15 pm

by hml >> Wed, 13 Nov 2002 12:02:42 GMT

Hi,

I am attempting to respond to an event within the Microsoft Messaging Queues (MSMQ), and cannot seem to get it to work properly.


I have created an event reference on my form class called hmlEvent, which is of type I_DMSMQEventEvents.

When a message is deposited in the message queue this event should fire and execute the code in its arrived method.
However I keep getting 'Attempted access via null object reference'. Similar code does work in VB fine and the event does fire, but I can't get it to work in Jade.

The line
q.beginNotifyAutomationEvent( self, "hmlEvent" );
is where the error occurs.

It seams as if the "hmlEvent" parameter, which is deffinitely defined is the cause of the problem.

Can any one who has any experience of events and MSQM possibly advise me of what is happening and how to resolve the problem.


Code


vars
qInfo : MSMQQueueInfo;
q : IMSMQQueue2;
qEvent : IMSMQEvent2;
begin
create qInfo;
create q;
create qEvent;

qInfo.pathName:=".\private$\test_queue";
q:=qInfo.open(1,0);

// error occurs here
q.beginNotifyAutomationEvent( self, "hmlEvent" );


q.enableNotification(qEvent,0,10);
end;


Many thanks,

julian.pickard@hml.co.uk

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Event handling in MSMQ advice please

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:15 pm

by cdshearer >> Wed, 13 Nov 2002 19:08:49 GMT

Hi Julian

No experience with this technology, but the obvious problem is that q is null - so, the line:

q := qInfo.open(1,0);

is returning a null reference from the open method on MSMQQueueInfo class.

Can you step into this code to see why it is returning a null reference?

Craig

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Event handling in MSMQ advice please

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:15 pm

by hml >> Thu, 14 Nov 2002 11:29:29 GMT

Got it sorted! The problem was that the event is caused on the qEvent object not the queue itself. When we called beginNotifyAutomationEvent on the qEvent object everything worked ok. Jade just gives a null object reference as it can't find the event on the queue.

Will put in a NFS for a new exception number for this.

Torrie


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 18 guests