[progress Communities] [progress Openedge Abl] Forum Post: Re: Does The Pas For Oe Supports...

  • Thread starter Thread starter Valeriy Bashkatov
  • Start date Start date
Status
Not open for further replies.
V

Valeriy Bashkatov

Guest
Hi Irfan, [quote user="Irfan "] For your-use, I think you can run an asynchronous procedure in an agentStartupProcedure which would subscribe to the Queue in MQ and do the respective actions. [/quote] I have created such a procedure (JMSServerExample.p): DEFINE INPUT PARAMETER inputParam AS CHAR. DEFINE VARIABLE ptpsession AS HANDLE. DEFINE VARIABLE replyMessage AS HANDLE. DEFINE VARIABLE consumerH AS HANDLE. define var BrokerURL as character no-undo. def var Is_connected as logical no-undo. BrokerURL = "tcp://172.16.95.131:2506". run jms/ptpsession.p persistent set ptpsession ("-SMQConnect"). run setConnectionURLs in ptpsession (BrokerURL). run setReconnectTimeout in ptpsession (600). /* in minutes */ RUN setReconnectInterval IN ptpsession (10). /* in seconds */ run setPingInterval in ptpsession (5) . run setFaultTolerant in ptpsession(false). run setNoErrorDisplay in ptpsession (true). run setUser in ptpsession ("Administrator"). run setPassword in ptpsession ("Administrator"). do on error undo, leave: run beginSession in ptpsession. Is_connected = true. end. if Is_connected then do: RUN createTextMessage IN ptpsession (OUTPUT replyMessage). RUN createMessageConsumer IN ptpsession ( THIS-PROCEDURE, /* This proc will handle it */ "requestHandler", /* name of internal procedure */ OUTPUT consumerH). RUN receiveFromQueue IN ptpsession ("PASQ1", /* request queue */ ?, /* No message selector */ consumerH). /* Handles the messages */ RUN startReceiveMessages IN ptpsession. RUN waitForMessages IN ptpsession ("inWait", THIS-PROCEDURE, ?). end. else do: message "No connection to the broker!". pause 0. end. PROCEDURE requestHandler: DEFINE INPUT PARAMETER requestH AS HANDLE. DEFINE INPUT PARAMETER msgConsumerH AS HANDLE. DEFINE OUTPUT PARAMETER replyH AS HANDLE. DEFINE VAR replyText AS CHAR. /* Creates a reply message. The reply is sent automatically when control returns to the 4GL-To-JMS implementation. */ replyText=inputParam + " executed " + DYNAMIC-FUNCTION('getText':U IN requestH). message replyText. pause 0. RUN deleteMessage IN requestH. replyH = replyMessage. RUN setText IN replyH (replyText). end. FUNCTION inWait RETURNS LOGICAL. RETURN true. end. I used the code from the example of documentation, OpenEdge® Development: Messaging and ESB (example21.p), Messaging Examples topic. Then define this procedure in agentStartupProc and restart the server. To test the listener I used example20.p from the same documentation. At first glance everything seems to be working fine. Nevertheless, it may be necessary to add something to a procedure (JMSServerExample.p) for better performance and reliability? How do you think? Regards, Valeriy

Continue reading...
 
Status
Not open for further replies.
Back
Top