Starting the Publisher Client and Sending Messages
Setting up the publisher is very similar to setting up the subscriber. However, while the subscriber requires the name of the topic and the user, the publisher also requires messages.
Procedure
Result
The command line window will display a message stating that both messages have been published:
Publishing on topic 'myTopic' Published message: hello Published message: user2
After the messages are published, the command window for the publisher returns to the prompt for further message publishing.
Note: Note that if you attempt to use the form:
java tibjmsMsgProducer -topic myTopic -user user1
without adding the messages, you will see an error message, reminding you that you must have at least one message text.
The first and second command line windows containing the subscribers will show that each subscriber received the two messages:
Subscribing to destination: myTopic Received message: TextMessage={ Header={ JMSMessageID={ID:EMS-SERVER.16C5B5C81B3CB4:1} JMSDestination={Topic[myTopic]} JMSReplyTo={null} JMSDeliveryMode={PERSISTENT} JMSRedelivered={false} JMSCorrelationID={null} JMSType={null} JMSTimestamp={Thu Mar 07 18:18:01 CST 2019} JMSDeliveryTime={Thu Mar 07 18:18:01 CST 2019} JMSExpiration={0} JMSPriority={4} } Properties={ JMSXDeliveryCount={Integer:1} } Text={hello} } Received message: TextMessage={ Header={ JMSMessageID={ID:EMS-SERVER.16C5B5C81B3CB4:2} JMSDestination={Topic[myTopic]} JMSReplyTo={null} JMSDeliveryMode={PERSISTENT} JMSRedelivered={false} JMSCorrelationID={null} JMSType={null} JMSTimestamp={Thu Mar 07 18:18:01 CST 2019} JMSDeliveryTime={Thu Mar 07 18:18:01 CST 2019} JMSExpiration={0} JMSPriority={4} } Properties={ JMSXDeliveryCount={Integer:1} } Text={user2} }
Copyright © Cloud Software Group, Inc. All rights reserved.