## Batch file to configure the domain for the messaging-clustering quickstart.

# -- Stop the currently running servers
:stop-servers

batch

# -- Add a group for testing Messaging Clustering
/server-group=quickstart-messaging-clustering-group:add(profile=full-ha, socket-binding-group=full-ha-sockets)

# -- Add two servers to the new quickstart-messaging-clustering-group
/host=master/server-config=quickstart-messagingcluster-node1:add(group=quickstart-messaging-clustering-group, auto-start=true, socket-binding-port-offset=1000)
/host=master/server-config=quickstart-messagingcluster-node2:add(group=quickstart-messaging-clustering-group, auto-start=true, socket-binding-port-offset=1100)

# -- Configure Messaging Clustering in the full-ha profile
/profile=full-ha/subsystem=messaging-activemq/server=default:write-attribute(name=cluster-password, value=password)
/profile=full-ha/subsystem=messaging-activemq/server=default/connection-factory=RemoteConnectionFactory/:undefine-attribute(name=connectors)
/profile=full-ha/subsystem=messaging-activemq/server=default/connection-factory=RemoteConnectionFactory/:write-attribute(name=discovery-group, value=dg-group1)

# -- Deploy the helloworld-mdb.war file (from the ../helloworld-mdb quickstart)
# NOTE: The following command assumes the helloworld-mdb quickstart is at the same level in the file structure as this quickstart.
#       If the helloworld-mdb quickstart is in another location, modify its path in the following line.
deploy --server-groups=quickstart-messaging-clustering-group ../helloworld-mdb/target/helloworld-mdb.war

# -- Run this batch file
run-batch

# -- Start the newly defined servers
/host=master/server-config=quickstart-messagingcluster-node1:start(blocking=true)
/host=master/server-config=quickstart-messagingcluster-node2:start(blocking=true)
