Author: timfox
Date: 2009-11-11 04:37:55 -0500 (Wed, 11 Nov 2009)
New Revision: 8258
Modified:
trunk/examples/jms/bridge/server0/hornetq-configuration.xml
trunk/examples/jms/bridge/server1/hornetq-configuration.xml
trunk/examples/jms/bridge/src/org/hornetq/jms/example/BridgeExample.java
Log:
put bridge example back like it was
Modified: trunk/examples/jms/bridge/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/bridge/server0/hornetq-configuration.xml 2009-11-10 22:54:21 UTC
(rev 8257)
+++ trunk/examples/jms/bridge/server0/hornetq-configuration.xml 2009-11-11 09:37:55 UTC
(rev 8258)
@@ -41,24 +41,11 @@
<forwarding-address>jms.queue.mincing-machine</forwarding-address>
<filter string="name='aardvark'"/>
<transformer-class-name>org.hornetq.jms.example.HatColourChangeTransformer</transformer-class-name>
- <reconnect-attempts>-1</reconnect-attempts>
-
- <confirmation-window-size>500000</confirmation-window-size>
-
+ <reconnect-attempts>-1</reconnect-attempts>
<connector-ref connector-name="remote-connector"/>
</bridge>
</bridges>
-
- <address-settings>
- <address-setting match="jms.queue.sausage-factory">
- <max-size-bytes>10000000</max-size-bytes>
- <page-size-bytes>1000000</page-size-bytes>
- <address-full-policy>PAGE</address-full-policy>
- </address-setting>
- </address-settings>
-
-
<!-- Other config -->
<security-settings>
Modified: trunk/examples/jms/bridge/server1/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/bridge/server1/hornetq-configuration.xml 2009-11-10 22:54:21 UTC
(rev 8257)
+++ trunk/examples/jms/bridge/server1/hornetq-configuration.xml 2009-11-11 09:37:55 UTC
(rev 8258)
@@ -22,15 +22,6 @@
</acceptors>
<!-- Other config -->
-
- <address-settings>
-
- <address-setting match="jms.queue.sausage-factory">
- <max-size-bytes>10000</max-size-bytes>
- <page-size-bytes>1000</page-size-bytes>
- <address-full-policy>PAGE</address-full-policy>
- </address-setting>
- </address-settings>
<security-settings>
<!--security for example queue-->
Modified: trunk/examples/jms/bridge/src/org/hornetq/jms/example/BridgeExample.java
===================================================================
--- trunk/examples/jms/bridge/src/org/hornetq/jms/example/BridgeExample.java 2009-11-10
22:54:21 UTC (rev 8257)
+++ trunk/examples/jms/bridge/src/org/hornetq/jms/example/BridgeExample.java 2009-11-11
09:37:55 UTC (rev 8258)
@@ -12,7 +12,6 @@
*/
package org.hornetq.jms.example;
-import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Message;
@@ -50,7 +49,7 @@
try
{
- // Step 1 - we create an initial context for looking up JNDI on node 0
+ // Step 1 - we create an initial context for looking up JNDI on node 0
ic0 = getContext(0);
@@ -99,61 +98,42 @@
// Step 12. We create a JMS MessageProducer object on server 0
MessageProducer producer = session0.createProducer(sausageFactory);
- final int numMessages = 100000;
-
- byte[] bytes = new byte[1000];
+ // Step 13. We create and send a message representing an aardvark with a green
hat to the sausage-factory
+ // on node 0
+ Message message = session0.createMessage();
- for (int i = 0; i < numMessages; i++)
- {
+ message.setStringProperty("name", "aardvark");
- // Step 13. We create and send a message representing an aardvark with a
green hat to the sausage-factory
- // on node 0
- BytesMessage message = session0.createBytesMessage();
+ message.setStringProperty("hat", "green");
- message.setStringProperty("name", "aardvark");
+ producer.send(message);
- message.setStringProperty("hat", "green");
-
- message.writeBytes(bytes);
+ System.out.println("Sent " +
message.getStringProperty("name") +
+ " message with " +
+ message.getStringProperty("hat") +
+ " hat to sausage-factory on node 0");
- producer.send(message);
-
- if (i % 1000 == 0)
- {
- System.out.println("Sent " + i);
- }
- }
-
// Step 14 - we successfully receive the aardvark message from the
mincing-machine one node 1. The aardvark's
// hat is now blue since it has been transformed!
- for (int i = 0; i < numMessages; i++)
- {
- Message receivedMessage = consumer.receive(5000);
-
- if (receivedMessage == null)
- {
- throw new IllegalStateException("Did not receive message");
- }
+ Message receivedMessage = consumer.receive(5000);
- if (i % 1000 == 0)
- {
- System.out.println("Received " + i);
- }
+ System.out.println("Received " +
receivedMessage.getStringProperty("name") +
+ " message with " +
+ receivedMessage.getStringProperty("hat") +
+ " hat from mincing-machine on node 1");
- // Step 13. We create and send another message, this time representing a
sasquatch with a mauve hat to the
- // sausage-factory on node 0. This won't be bridged to the
mincing-machine since we only want aardvarks, not
- // sasquatches
- }
-
- Message message = session0.createMessage();
+ // Step 13. We create and send another message, this time representing a
sasquatch with a mauve hat to the
+ // sausage-factory on node 0. This won't be bridged to the mincing-machine
since we only want aardvarks, not sasquatches
+ message = session0.createMessage();
+
message.setStringProperty("name", "sasquatch");
- message.setStringProperty("hat", "mauve");
+ message.setStringProperty("hat", "mauve");
producer.send(message);
-
+
System.out.println("Sent " +
message.getStringProperty("name") +
" message with " +
message.getStringProperty("hat") +
@@ -161,7 +141,7 @@
// Step 14. We don't receive the message since it has not been bridged.
- Message receivedMessage = (TextMessage)consumer.receive(1000);
+ receivedMessage = (TextMessage)consumer.receive(1000);
if (receivedMessage == null)
{
Show replies by date