/* Publishes A Text message to an illegal topic name and handles the
error conditions. */ DEFINE VARIABLE hPubSubSession AS HANDLE NO-UNDO. DEFINE VARIABLE hMessage AS HANDLE NO-UNDO. DEFINE VARIABLE lSuccess AS LOGICAL NO-UNDO. /* Creates a session object. */ RUN jms/pubsubsession.p PERSISTENT SET hPubSubSession ("-H localhost -S 5162 "). RUN setNoErrorDisplay IN hPubSubSession (true). RUN setBrokerURL IN hPubSubSession ("localhost:2506"). RUN beginSession IN hPubSubSession. /* Create a text message */ RUN createTextMessage IN hPubSubSession (OUTPUT hMessage). RUN setText IN hMessage ("Golf shoes on sale today."). /* Publish the message on the illegal '*' topic */ DO ON ERROR UNDO, LEAVE: RUN publish IN hPubSubSession ("*", hMessage, ?, ?, ?). lSuccess = TRUE. END. If NOT lSuccess THEN MESSAGE "Failed to publish to topic '*': " RETURN-VALUE VIEW-AS ALERT-BOX. RUN deleteMessage IN hMessage. RUN deleteSession IN hPubSubSession. |