NAS not answering the handler function “MessageReceived”

himadripaulhimadripaul Member Posts: 21
I am trying to read data from MSMQ by using Navision Communication component and MSMQ Bus adapters. The code has been written in Codeunit which is run by NAS. The NAS is running fine with the starting parameter.

The problem is: when a new message is sent to the request queue, the Application Server does not process it. The OnRun() trigger of the codeunit gets fired ( I have put one message and it is getting processed) but the handler function “MessageReceived” is not fired. I have checked my message in the Event viewer. I put a "MESSAGE" statement at the beginning of the function but I don't see anything on the message log.

Please help me out.
«1

Comments

  • garakgarak Member Posts: 3,263
    Do you have enabled the property "WithEvent" on your "Navision Communication component" variable?

    Regards
    Do you make it right, it works too!
  • kinekine Member Posts: 12,562
    1) MSMQ NAV component is not working on x64bit OS.
    2) The message must have specific label to be processed by the component ("Navision MSMQ-BA")
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • himadripaulhimadripaul Member Posts: 21
    The “WithEvent” property of "Navision Communication component" is enabled. MSMQ is working on 32 bit OS. Still I am getting the same problem.
  • kinekine Member Posts: 12,562
    And the label of the message is correct?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • himadripaulhimadripaul Member Posts: 21
    The Lable of the message is passing form a .NET application into MSMQ. But still I am facing the same problem.
  • kinekine Member Posts: 12,562
    Yes, but is it exactly "Navision MSMQ-BA"??? If not, NAV MSMQ component will not process this message...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • himadripaulhimadripaul Member Posts: 21
    Hi,

    Thanks for the info. I have made label as "Navision MSMQ-BA" but still my problem remain unsloved.

    In the Event Viewer--> Application--> Property I am seeing that ComCon is created but that particular function (MessageReceived) is not getting fired.

    Please help me out.
  • BBlueBBlue Member Posts: 90
    Is your request queue transactional? As far as I remember the MSMQ component in NAV only accepts messages from non-transactional queues.
    //Bogdan
  • himadripaulhimadripaul Member Posts: 21
    My "toNavision" queue is not transactional.
  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    Does the user you are using to run the NAS have access to the Queue, check the security settings on your queues. For testing purposes, give everyone full access.
    Then restrict access to the NAS-user after you were able to receive the message.

    Also is your queue a private or public queue? If it is public, create a queue as a private queue and use that for testing.

    Hope this helps,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • himadripaulhimadripaul Member Posts: 21
    Hi Willy,

    Thanks for your response. I have given full access to everyone in the security setting of my Private Queue but the problem remain unsolved. :(

    Please let me know what all I need to check further. ](*,)
  • himadripaulhimadripaul Member Posts: 21
    Hi,
    I am getting a new Warning when looking into the Computer Manamement--> Event Viewer-->Application--> One warning is coming as follows:

    "The call to member OpenReplyQueue failed. MSMQQueueInfo returned the following message:
    The queue does not exist or you do not have sufficient permissions to perform the operation. "

    I have checked the Private Message queue and the the same Queue name is there in codeunit. I have given Full permission also in the queue property for all the users.

    Any help please!!!
  • kfuglsangkfuglsang Member Posts: 26
    Perhaps you could paste the path to your queue.

    If the Queue is located on another machine, you might have to give permissions to "anonymous logon" for the NAS to be able to open the queue. "anonymous logon" is, based on my experience, not included in "everyone".
  • himadripaulhimadripaul Member Posts: 21
    Hi,

    The queue is located in the same machine where NAS is installed.
  • kinekine Member Posts: 12,562
    I guess you have two queues - incoming and outcoming. Did you checked the permissions on both? Sometime it is better to delete the queues and create them manually again, with correct permissions. It seems that the outcomming queue is not created...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    Could you please paste your code to this forum. This might help us a lot.
    I think the problem lies in the way you are defining your queue name in the C/AL code.

    Please paste the name of your queue in code and the section of code where you create and use your automation.

    Thank you,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • himadripaulhimadripaul Member Posts: 21
    Hi,

    The permission problem of Message Queue gets solved. But when I am running Navision application , in Computer Management-->Even Viewer--> Application, I am seeing the descriprion of each of the information like "Open Receive Queue", "Create MSMQ", "Create ComCom" (all the messages I have introduced in my codeunit for better clarity) But the last informaion is coming as follows:

    "The description for Event ID ( 20010 ) in Source ( SM8LAPCA-001-SQL ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event:
    Navision Application Server version 4.0 SP3 (Build 23305)
    Copyright (c) 1987-2006 Microsoft Corporation"

    And finally I am not getting any value in my table (created in Navision) from the queue. The insert statement is written in the codeunit under (ComCom::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") function.

    Please help me out.

    .
  • himadripaulhimadripaul Member Posts: 21
    My Code is as follows:

    OnRun()

    MESSAGE('Enter codunit'); // This info is showing in Event Viewer (Computer management)
    IF ISCLEAR(ComCom) THEN BEGIN
    CREATE(ComCom);
    MESSAGE('Created ComCom');
    END;

    IF ISCLEAR(MSMQ_BA) THEN BEGIN
    CREATE(MSMQ_BA);
    MESSAGE('Created MSMQ'); // This info is showing in Event Viewer (Computer management)

    END;


    Queue1Name := '.\private$\sendqueue';
    Queue2Name := '.\private$\fromnavision';

    ComCom.AddBusAdapter(MSMQ_BA,1);
    MSMQ_BA.OpenReceiveQueue(Queue1Name,0,0);
    MESSAGE('Open receive Queue'); // This info is showing in Event Viewer (Computer management)
    MSMQ_BA.OpenReplyQueue(Queue2Name,0,0);


    ComCom::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") // This function is
    //not working

    MESSAGE('New MSMQ message received!');
    InMsg := InMessage;
    InStreamQueue := InMsg.GetStream();

    REPEAT
    InStreamQueue.READTEXT(XMLChar);
    XMLText := XMLText + XMLChar;
    UNTIL InStreamQueue.EOS;
    CREATE(XMLDoc);
    XMLDoc.loadXML(XMLText);
    MESSAGE('hi');
    IF FindNode(XMLDoc,'string',XMLNode) THEN
    MsgCont := XMLNode.text;

    strFld1 := SELECTSTR(1,MsgCont);
    strFld2 := SELECTSTR(2,MsgCont);
    strFld3 := SELECTSTR(3,MsgCont);
    strFld3 := SELECTSTR(4,MsgCont);

    recWebtable.INIT;
    recWebtable.Code := strFld1;
    recWebtable.Name := strFld2;
    recWebtable.Address := strFld3;
    recWebtable."Contact No." := strFld4;
    recWebtable.INSERT;

    InMsg.CommitMessage;
    CLEAR(InMsg);

    Please help me out
  • BBlueBBlue Member Posts: 90
    Is your codeunit single instance? (Open codeunit in design mode, Shift + F4 or View - Properties, SingleInstance)
    It has to be single instance so that it't variables remain in computer memory in order to "listen" for the incoming messages...
    //Bogdan
  • himadripaulhimadripaul Member Posts: 21
    Yes. My codeunit is Singel Instance.
  • himadripaulhimadripaul Member Posts: 21
    Can I get anybody's msm id (@hotmail) so that I can add and chat online (if I am not disturbing anybody) for getting valuable inputs/ helps
  • kinekine Member Posts: 12,562
    Can you see some messages waiting in the queue when looking into the queue through computer management?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • himadripaulhimadripaul Member Posts: 21
    Messages is waiting in the queue. It has not been processed.
  • jlgjlg Member Posts: 4
    I've the same problem with MessageReceived function. No message is received, messages still in queue.
    I checked all parameters and authorization. Everything seem ok but it doesn't work.
    Did you solve your problem ?
    Could you help me ?
  • kinekine Member Posts: 12,562
    jlg wrote:
    I've the same problem with MessageReceived function. No message is received, messages still in queue.
    I checked all parameters and authorization. Everything seem ok but it doesn't work.
    Did you solve your problem ?
    Could you help me ?

    Did you checked that:
    you are using 32bit OS?
    message has correct label?
    message is in correct format (UTF-8 and not UTF-16)?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    could you try it with the direct queue name.
    You have:
    Queue1Name := '.\private$\sendqueue';
    Queue2Name := '.\private$\fromnavision';

    try it with:
    Queue1Name := 'Direct=OS:\\<computername>\private$\sendqueue';
    Queue2Name := 'Direct=OS:\\<computername>\private$\fromnavision';

    Where <computername> is the name of the computer where the Queue resides.

    I had it once that the direct option worked and the other did not.

    Hope this helps,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • jlgjlg Member Posts: 4
    Kine,
    I checked and parameters are ok.

    KyDutchie,
    I tried with format 'Direct=OS:\\<computername>\private$\sendqueue' and NAS return this error :
    The call to member OpenReceiveQueue failed. MSMQQueueInfo returned the following message:
    The format name specified is invalid.

    I tried with format 'Direct=TCP:\\<IP address>\private$\sendqueue' and NAS return this error :
    The call to member OpenReceiveQueue failed. MSMQQueueInfo returned the following message:
    The remote computer is not available.
  • jlgjlg Member Posts: 4
    It seems that my codeunit don't receive event when a new message arrives in the queue. So,
    MessageReceived function don't start.
    Could you help me ?
  • himadripaulhimadripaul Member Posts: 21
    Hi Kine,

    How do I know that my message is in correct format (UTF-8 and not UTF-16) ?
  • kinekine Member Posts: 12,562
    When you look at the message or you somehow export it, there must be only one byte per character, not two (second is 0x0 char...).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.