Information about the source of an incoming Message?

chrmueller
Member Posts: 9
Hello,
has somebody expiriences with the NAS and the ComCom in this way?:
With the Communication Component 2 of Navision it is possible to add more than one Adapter (even different kind of Adapters: e.g. a MessageQueue-, a NamedPipe- and a Socket-Adapter) to one instance of a Communication Component. But I only have one event (the event from the Component "MessageReceived") to catch incoming messages.
Here's my question: How can I decide from which Adaptor this message comes? Does anybody have a code example?
Thanks
Christian
has somebody expiriences with the NAS and the ComCom in this way?:
With the Communication Component 2 of Navision it is possible to add more than one Adapter (even different kind of Adapters: e.g. a MessageQueue-, a NamedPipe- and a Socket-Adapter) to one instance of a Communication Component. But I only have one event (the event from the Component "MessageReceived") to catch incoming messages.
Here's my question: How can I decide from which Adaptor this message comes? Does anybody have a code example?
Thanks
Christian
0
Comments
-
I haven't verified it but did you try InMessage.Source() (a string) to see if that can be used to sort out who's sending you the message?
(as soon as I get rid of my irritating active directory error I'll try to verify this little interesting issue)Did I commit today?0 -
Hello LG,
yes, I've tried that one... The Method .source() only works with the SocketAdapter. You can get the IP-Adress where the request comes from. But that isn't enough. There's no information about the socket-port or the instance-no.
But thank you as well!!!
Greetz
Christian0 -
ouch... bad bad bad
I guess you need to get the message itself tagged with ID, like the first 10 characters, but that might be hard to do if you don't have ownership of the creating instance..
:?Did I commit today?0 -
note:
I use 3 chars in each message to ID what is arriving.
Following is a complete codeunit (SingleInstance) and I use a Form with two buttons sending either text or a xml-doc (resp. function).
On the other hand I create the message in this example :S, a feature we all not necessary haveDocumentation() OnRun() IF ISCLEAR(DOM3) THEN CREATE(DOM3); IF ISCLEAR(NCC2) THEN CREATE(NCC2); IF ISCLEAR(MSMQBus) THEN CREATE(MSMQBus); NCC2.AddBusAdapter(MSMQBus,1); MSMQBus.OpenReceiveQueue('.\ncc2_queue',0,2); SendHelloWorld() MSMQBus.OpenWriteQueue('.\ncc2_queue',0,2); NCC2OutMsg := NCC2.CreateoutMessage('Message queue://'); OutStr := NCC2OutMsg.GetStream(); OutStr.WRITETEXT('TXT'); OutStr.WRITETEXT('Hello World'); NCC2OutMsg.Send(0); SendXML() DOM3.load('c:\Add.xml'); MSMQBus.OpenWriteQueue('.\ncc2_queue',0,2); NCC2OutMsg := NCC2.CreateoutMessage('Message queue://'); OutStr := NCC2OutMsg.GetStream(); OutStr.WRITETEXT('XML'); DOM3.save(OutStr); NCC2OutMsg.Send(0); NCC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") NCC2InMsg := InMessage; InStr := NCC2InMsg.GetStream(); InStr.READTEXT(Str,3); CASE Str OF 'TXT': BEGIN InStr.READTEXT(Str,MAXSTRLEN(Str)); MESSAGE(Str); END; 'XML': BEGIN IF DOM3.load(InStr) THEN MESSAGE(COPYSTR(DOM3.documentElement().baseName(),1,100)); DOM3.save('c:\Add2.xml'); END; ELSE MESSAGE('Unknown Message') END; NCC2InMsg.CommitMessage();
Did I commit today?0
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