How to setup STOMP in JBoss AS 7 and create a java client call
Tech-Today

How to setup STOMP in JBoss AS 7 and create a java client call


This tutorial will teach us how we can enable stomp in JBoss 7.1.3 and create a sample java client call. 

What you need:
1.) JBoss AS7.1.3
2.) standalone-full.xml - this is where we will copy the settings

 Setup JBoss AS 7 1.)
1.) Add extension:
<extension module="org.jboss.as.messaging"/>

2.) Add hornet q subsystem, take note of: netty-aceptor
<subsystem xmlns="urn:jboss:domain:messaging:1.2">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<journal-file-size>102400</journal-file-size>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
<netty-acceptor name="stomp-acceptor" socket-binding="messaging-stomp">
<param key="protocol" value="stomp"/>
</netty-acceptor>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<address-full-policy>BLOCK</address-full-policy>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
</hornetq-server>
</subsystem>

3.) At the end of the file, add socket bindings:
<socket-binding name="messaging-stomp" port="61613"/>
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>

4.) Find subsystem: urn:jboss:domain:ejb3:1.3 and add:
<mdb>
<resource-adapter-ref resource-adapter-name="hornetq-ra"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
5.) To Add a jms queue, add the following lines before the
<jms-destinations>
<jms-queue name="test">
<entry name="queue/test" />
<entry name="/java:jboss:exported/jms/queue/test" />
</jms-queue>
</jms-destinations>




- Javaee Development
JavaEE6How to create a javaee6 web app using jboss maven war archetypeCreate a simple javaee6 web app with maven, glassfish and postgresqlHow to validate a JavaEE6 Bean in a jobHow to add JavaEE 6 archetypes in eclipse keplerHow to create a custom bean...

- How To Send And Receive Stomp Message In Jboss 7.2
The following code is an example of how we can send and receive a stomp message with JBoss 7.2. package org.meveo.util; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.util.Properties; import javax.naming.InitialContext;...

- How To Configure Mail Resource In Jboss 7.2 With A Sample Java Client
This tutorial assumes that you have the following installed on your local system: JBoss 7.2eclipse to run a projecta mail server, can be gmailIn this page we will summarize how to configure a mail dataSource in Jboss and create a JavaEE6 client to send...

- How To Setup Set Jms Factory And Queue In Glassfish
This tutorial assumes that you already have glassfish installed and running on your local machine. 1.) To check the default setting of your JMS broker navigate to Configurations->server-config->Java Message Service->JMS Hosts->default_JMS_host....

- Changing Jboss Server's Default Http Port
If you have installed jboss server in: C:\jboss-5.1.0\ then here's what you should do to change the default port (8080) to any port of your choice. 1.) Open the file, C:\jboss-5.1.0\server\default\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml...



Tech-Today








.