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

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

batch

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

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

# -- Enable the console to allow us to view the quickstart output.
/profile=full-ha/subsystem=logging/console-handler=CONSOLE:add(level=INFO,formatter="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n")
/profile=full-ha/subsystem=logging/root-logger=ROOT:add-handler(name="CONSOLE")

# -- 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)

# -- Add mdb-delivery-group named "my-mdb-delivery-group" to full-ha profile
/profile=full-ha/subsystem=ejb3/mdb-delivery-group=my-mdb-delivery-group:add(active=true)

# -- Deploy the messaging-clustering-singleton.war file
# NOTE: The following command assumes the quickstart is built
#       If that is not the case, run mvn clean install before this script
deploy --server-groups=quickstart-messaging-clustering-singleton-group target/messaging-clustering-singleton.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)
