All Examples This Package JMS Examples
examples.jms.drawdemo.JMSDrawDemo
Configure the server:
Build the example:
$ javac -d %CLIENT_CLASSES% JMSDrawDemo.java
Run the example:
$ java examples.jms.drawdemo.JMSDrawDemo t3://hostname:port [DurableSubID]where:
Each JMSDrawDemo instance displays a canvas. A click of the mouse on a canvas publishes the mouse coordinates in a message to the JMS topic. When other instances of the application receive a message from the Topic, they display an icon at the specified coordinates. As you click on one canvas, the others duplicate the arrangement of icons.
The JMSDrawDemo application has buttons and checkboxes that send commands or or change various parameters. If you click the Clear button, the application sends a clearScreen message to the Topic. When the message is delivered, all instances of the application clear their canvasses.
Check the Transacted checkbox to turn on "transacted" mode. When the transacted mode is on, JMS does not send messages until you click the Commit button. Or click the Rollback button to roll back the transaction. To view a commit graphically, click several times on the canvas, then click the Commit button. Other canvasses do not update until you commit.
Persistent messages are of most interest to durable subscribers. By running this example with an (optional) durable subscriber name as the second argument, a durable subscription is established. Check the Persistent checkbox to enable persistent JMS messages. Persistent messages sent when the subscriber is not active will be delivered when the subscriber reattaches, even after rebooting the WebLogic Server.
public static final String JNDI_FACTORYJMS_FACTORY
public static final String JMS_FACTORYTOPIC
public static final String TOPICIMAGE
public static final String IMAGE
public JMSDrawDemo(JFrame frame, String url, String durableSubscriberID) throws NamingException, JMSException
public void onMessage(Message msg)
public void paint(Graphics g)
public Dimension getPreferredSize()mousePressed
public void mousePressed(MouseEvent e)
public void mouseClicked(MouseEvent e)mouseEntered
public void mouseEntered(MouseEvent e)mouseExited
public void mouseExited(MouseEvent e)mouseReleased
public void mouseReleased(MouseEvent e)
public void actionPerformed(ActionEvent ev)
public Image loadImage(String resourceName)
public boolean imageUpdate(Image image, int infoFlags, int x, int y, int width, int height)main
public static void main(String argv[]) throws NamingException, JMSException
All Examples This Package JMS Examples