Last active
August 29, 2015 13:56
-
-
Save cemartins/8803169 to your computer and use it in GitHub Desktop.
Node 2 messaging subsystem setup - wildfly 8 hosting application 2 that publishes event messages to the embedded hornetq broker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> | |
<property name="jndiName"> | |
<value>ConnectionFactory</value> | |
</property> | |
<property name="resourceRef"><value>true</value></property> | |
</bean> | |
<bean id="myBrokerSendDestination" class="org.springframework.jndi.JndiObjectFactoryBean"> | |
<property name="jndiName"> | |
<value>jms/topic/EventsTopic</value> | |
</property> | |
<property name="resourceRef"><value>true</value></property> | |
</bean> | |
<bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate"> | |
<property name="connectionFactory" ref="jmsConnectionFactory" /> | |
<property name="defaultDestination" ref="myBrokerSendDestination" /> | |
<property name="sessionTransacted" value="true" /> | |
<property name="sessionAcknowledgeMode" value="#{T(javax.jms.Session).CLIENT_ACKNOWLEDGE}" /> | |
<property name="pubSubDomain" value="false" /> | |
<property name="receiveTimeout" value="#{T(org.springframework.jms.core.JmsTemplate).RECEIVE_TIMEOUT_NO_WAIT}" /> | |
</bean> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<subsystem xmlns="urn:jboss:domain:messaging:2.0"> | |
<hornetq-server> | |
<persistence-enabled>true</persistence-enabled> | |
<journal-file-size>102400</journal-file-size> | |
<journal-min-files>2</journal-min-files> | |
<connectors> | |
<http-connector name="http-connector" socket-binding="http"> | |
<param key="http-upgrade-endpoint" value="http-acceptor"/> | |
</http-connector> | |
<http-connector name="http-connector-throughput" socket-binding="http"> | |
<param key="http-upgrade-endpoint" value="http-acceptor-throughput"/> | |
<param key="batch-delay" value="50"/> | |
</http-connector> | |
<in-vm-connector name="in-vm" server-id="0"/> | |
<in-vm-connector name="in-vm" server-id="0"/> | |
</connectors> | |
<acceptors> | |
<netty-acceptor name="netty-node2" socket-binding="node2-jms-broker"/> | |
<http-acceptor name="http-acceptor" http-listener="default"/> | |
<http-acceptor name="http-acceptor-throughput" http-listener="default"> | |
<param key="batch-delay" value="50"/> | |
<param key="direct-deliver" value="false"/> | |
</http-acceptor> | |
<in-vm-acceptor name="in-vm" server-id="0"/> | |
</acceptors> | |
<!-- switching off security because all clients are withing a protected network --> | |
<security-enabled>false</security-enabled> | |
<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"/> | |
<permission type="createDurableQueue" roles="guest"/> | |
<permission type="deleteDurableQueue" roles="guest"/> | |
</security-settings> | |
<address-settings> | |
<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> | |
<page-size-bytes>2097152</page-size-bytes> | |
<address-full-policy>PAGE</address-full-policy> | |
<message-counter-history-day-limit>10</message-counter-history-day-limit> | |
</address-setting> | |
</address-settings> | |
<jms-connection-factories> | |
<!-- This is the connection factory that App 2 will use to publish --> | |
<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="http-connector"/> | |
</connectors> | |
<entries> | |
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/> | |
</entries> | |
</connection-factory> | |
<connection-factory name="DurableSubscribersConnectionFactory"> | |
<connectors> | |
<connector-ref connector-name="http-connector"/> | |
</connectors> | |
<entries> | |
<entry name="java:/DurableSubscribersConnectionFactory"/> | |
<entry name="java:jboss/exported/DurableSubscribersConnectionFactory"/> | |
</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"/> | |
<entry name="java:jboss/DefaultJMSConnectionFactory"/> | |
</entries> | |
</pooled-connection-factory> | |
</jms-connection-factories> | |
<!-- This is the topic where the messages from App 2 will be stored --> | |
<jms-destinations> | |
<jms-topic name="EventsTopic"> | |
<entry name="jms/topic/EventsTopic"/> | |
<entry name="java:jboss/exported/jms/topic/EventsTopic"/> | |
</jms-topic> | |
</jms-destinations> | |
</hornetq-server> | |
....... | |
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"> | |
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/> | |
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/> | |
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/> | |
<socket-binding name="http" port="${jboss.http.port:8080}"/> | |
<socket-binding name="https" port="${jboss.https.port:8443}"/> | |
<socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/> | |
<socket-binding name="txn-recovery-environment" port="4712"/> | |
<socket-binding name="txn-status-manager" port="4713"/> | |
<socket-binding name="node2-jms-broker" port="${node2.broker.port:5445}"/> | |
</socket-binding-group> | |
</subsystem> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
standalone2.xml is the messaging-subsystem part of a wildfly server configuration file (standalone2.xml). I added a JMS Topic and disabled security for connections to the embedded hornetq broker.
application-2-context.xml is the snippet of a spring application-context.xml that configures the JmsTemplate to send messages to the hornetq topic.
See also Node 1, a spring-integration that listens to messages published on the hornetq at this Node 2 using a durable subscription and the remote connection.