HornetQ embedded Cluster Configuration - hornetq

I am trying to start an embedded cluster configuration but I wasn't able to do so.
I used the cluster example that was found on the hornetq examples. It works, I aren't to run the examples using an embedded hornetq. I can't get any exception but the system dies.
public class HornetQEmbedded {
private JMSServerManager jmsServerManager;
public HornetQEmbedded() {
}
public void start() {
try {
System.out.println("Starting Embedded HornetQ instance...");
// Retrieve configuration from xml file
FileConfiguration configuration = new FileConfiguration();
configuration.setConfigurationUrl("hornetq-configuration.xml");
configuration.start();
// Change acceptor configuration
Map<String, Object> acceptorParams = new HashMap<String, Object>();
acceptorParams.put(TransportConstants.PORT_PROP_NAME, "5446");
acceptorParams.put(TransportConstants.HOST_PROP_NAME, "0.0.0.0");
configuration.getAcceptorConfigurations().clear();
configuration.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName(), acceptorParams));
// Change connector configuration
Map<String, Object> connectorParams = new HashMap<String, Object>();
connectorParams.put(TransportConstants.PORT_PROP_NAME, "5446");
connectorParams.put(TransportConstants.HOST_PROP_NAME, "0.0.0.0");
configuration.getConnectorConfigurations().clear();
configuration.getConnectorConfigurations().put("netty", new TransportConfiguration(NettyAcceptorFactory.class.getName(), connectorParams));
// Create HornetQ server
HornetQServer server = HornetQServers.newHornetQServer(configuration);
server.getSecurityManager().addUser("guest", "guest");
server.getSecurityManager().setDefaultUser("guest");
server.getSecurityManager().addRole("guest", "guest");
// Load queues
jmsServerManager = new JMSServerManagerImpl(server, "hornetq-jms.xml");
jmsServerManager.setContext(null);
// Start server
jmsServerManager.start();
System.out.println("Waiting 5 second for embedded hornetq server to start...");
Thread.sleep(5000);
} catch (Exception e) {
System.out.println("Error starting Embedded HornetQ server: " + e.toString());
throw new RuntimeException(e);
}
}
}
And this is the HornetQ configuration file:
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
<paging-directory>data/paging</paging-directory>
<bindings-directory>data/bindings</bindings-directory>
<journal-directory>data/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<large-messages-directory>data/large-messages</large-messages-directory>
<connectors>
<connector name="netty">
<factory- class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/>
<param key="port" value="${hornetq.remoting.netty.port:5444}"/>
</connector>
</connectors>
<acceptors>
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${hornetq.remoting.netty.host:0.0.0.0}"/>
<param key="port" value="${hornetq.remoting.netty.port:5446}"/>
</acceptor>
</acceptors>
<!-- Clustering configuration -->
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<group-address>127.0.0.1</group-address> <!-- 231.7.7.7 -->
<group-port>5442</group-port> <!-- 9876 -->
<broadcast-period>100</broadcast-period>
<connector-ref>netty-connector</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="my-discovery-group">
<group-address>127.0.0.1</group-address> <!-- 231.7.7.7 -->
<group-port>5442</group-port> <!-- 9876 -->
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>true</forward-when-no-consumers>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="my-discovery-group"/>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" 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>
<page-size-bytes>10485760</page-size-bytes>
<max-size-bytes>209715200</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
</address-setting>
</address-settings>
</configuration>

The example was written thinking on the embedded use case.. The server will live as part of your application. What means as long as your VM dies, the server will die.
On an embedded server, you are supposed to start a thread and leave it running.
As a hack now, try adding a sleep at the end of your start, but then make your proper application with a proper life cycle.

Related

JBoss EAP 7.4 and ActiveMQ Artemis 2.18.0 JMS bridge

I've been working with OpenMQ to ActiveMQ Artemis migration, and I'm having a bit of a problem getting my head around the JMS bridge concept. In OpenMQ JBoss's configuration we had JMS bridges but while migrating to ActiveMQ Artemis and re-making the standalone configuration I came to a problem where I can't get the JMS bridges working. Maybe there is a chance that someone could give me an example of how they are written properly or just do it for my configuration so I have a good example?
(Don't mind only 1 ip, I've changed everything since I can't share ip's etc.)
Broker is a remote Artemis cluster which has 2 queues - sync.Trigger.gg and dlq.sync.Trigger.gg. I want a JMS bridge on JBoss to consume the message from the remote ActiveMQ Artemis (which in configuration is 1.0.0.1:61616) and send that message in the local queue named SyncTriggerQueue, and if the consumption fails by my deployed App then another bridge should send it back to dlq.sync.Trigger.gg. I know that I need 2 bridges for this (i.e. 1 in bridge for reading and writing to inbuilt queue and 1 out bridge for sending it to the DLQ).
I have 2 bridges in the configuration, and I've put "??" in the values where I don't know what to put inside. Could someone maybe fill it with the values it has to have from the story I've told? I would really appreciate help from someone who works with/knows these configurations.
P.S.
I've achieved a working configuration without the JMS bridges, but our Architect wants to keep it the way it was - with the bridges, so that's why I'm fighting with this.
P.S.S.
I have no idea if the in-built ActiveMQ queues are written properly, so feel free to re-make them.
Since I can't find how to add files here (probably not possible) then I'll just add my whole configuration as a code block, with some deleted parts that seem unnecessary.
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jgroups-broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<jgroups-discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="SyncTriggerQueue" entries="java:jboss/exported/SyncTriggerQueue" durable="false"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
<connection-factory name="SyncTriggerConnectionFactory" entries="java:jboss/exported/jms/TriggerRes" connectors="http-connector" client-id="TriggerMDB1" scheduled-thread-pool-max-size="8" thread-pool-max-size="32" factory-type="XA_GENERIC"/>
</server>
<jms-bridge name="SyncTriggerInBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="??"
connection-factory="??"
user="appusertest"
password="appusertest">
<source-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="??"/>
</source-context>
</source>
<target destination="??"
connection-factory="??">
</target>
</jms-bridge>
<jms-bridge name="SyncTriggerOutBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="??"
connection-factory="??">
</source>
<target destination="??"
connection-factory="??"
user="appusertest"
password="appusertest">
<target-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="??"/>
</target-context>
</target>
</jms-bridge>
</subsystem>
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
<resource-adapters>
<resource-adapter id="artemis-ra.rar">
<module slot="main" id="gg.go.artemis.rar" />
<transaction-support>XATransaction</transaction-support>
<config-property name="CallFailoverTimeout">30000</config-property>
<config-property name="CallTimeout">30000</config-property>
<config-property name="ClientFailureCheckPeriod">30000</config-property>
<config-property name="ConnectionLoadBalancingPolicyClassName">gg.go.artemis.loadbalancing.OrderedConnectionLoadBalancingPolicyLoggingImpl</config-property>
<config-property name="ConnectionParameters">host=1.0.0.1;port=61616</config-property>
<config-property name="ConnectorClassName">org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory</config-property>
<config-property name="ConsumerMaxRate">1</config-property>
<config-property name="HA">true</config-property>
<config-property name="InitialConnectAttempts">9</config-property>
<config-property name="MinLargeMessageSize">5120000</config-property>
<config-property name="Password">admin</config-property>
<config-property name="ReconnectAttempts">-1</config-property>
<config-property name="RetryInterval">-1</config-property>
<config-property name="ThreadPoolMaxSize">10</config-property>
<config-property name="UserName">admin</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory" jndi-name="java:jboss/DefaultArtemisConnectionFactory" enabled="true" connectable="true" pool-name="DefaultArtemisConnectionFactory" use-java-context="true" use-ccm="true" />
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
jms-bridge TRACE logs
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$SourceReceiver#6c989ca received message ActiveMQMessage[null]:PERSISTENT/ClientMessageImpl[messageID=2145, durable=true, address=rekku.SyncTrigger.virre,userID=null,properties=TypedProperties[_AMQ_ROUTING_TYPE=1]]
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$SourceReceiver#6c989ca rescheduled batchExpiryTime to 1660722704869
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 woke up
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waited enough
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waiting for 500
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 woke up
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waited enough
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#62859582 waiting for 500
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#57e98840 woke up
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#57e98840 waited enough
TRACE ... org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl$BatchTimeChecker#57e98840 got some messages so sending batch
TRACE ... Sending batch of 1 messages
TRACE ... Adding old message id in Message header
TRACE ... Sending message ActiveMQMessage[null]:PERSISTENT/ClientMessageImpl[messageID=2145, durable=true, address=sync.Trigger.gg,userID=null,properties=TypedProperties[_AMQ_ROUTING_TYPE=1,AMQ_BRIDGE_MSG_ID_LIST=NULL-value,JMSXDeliveryCount=1]]
TRACE ... Sent message ActiveMQMessage[ID:70bf4ffb-1e01-11ed-a09e-00059a3c7a00]:PERSISTENT/ClientMessageImpl[messageID=2145, durable=true, address=jms.queue.SyncTriggerQueue,userID=70bf4ffb-1e01-11ed-a09e-00059a3c7a00,properties=TypedProperties[__AMQ_CID=54a01028-1e01-11ed-a09e-00059a3c7a00,_AMQ_ROUTING_TYPE=1,AMQ_BRIDGE_MSG_ID_LIST=NULL-value,JMSXDeliveryCount=1]]
TRACE ... Delisting resources from tx
TRACE ... Delisted resources from tx
TRACE ... Committing JTA transaction
TRACE ... Committed JTA transaction
TRACE ... Starting JTA transaction
TRACE ... Enlisted resources in tx
TRACE ... Enlisting resources in tx
TRACE ... Started JTA transaction
Couple of things:
The bridge shouldn't use the ActiveMQ Artemis JCA RA so all the <resource-adapter> configuration is irrelevant. Therefore, I will not include it in my example.
There must be another local queue which the bridge can use to send the message back to the remote dlq.sync.Trigger.gg. This is the queue your application should use as a DLQ. I'll call this queue DlqSyncTriggerQueue. If you want the broker to handle sending failed messages to DlqSyncTriggerQueue then you should create a new address setting, e.g.:
<address-setting name="jms.queue.SyncTriggerQueue" dead-letter-address="jms.queue.DlqSyncTriggerQueue"/>
This assumes your application will be consuming messages from SyncTriggerQueue.
Here's the rest of the relevant configuration:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jgroups-broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<jgroups-discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="SyncTriggerQueue" entries="java:/SyncTriggerQueue" durable="false"/>
<jms-queue name="DlqSyncTriggerQueue" entries="java:/DlqSyncTriggerQueue" durable="false"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
<jms-bridge name="SyncTriggerInBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="sync.Trigger.gg"
connection-factory="ConnectionFactory"
user="appusertest"
password="appusertest">
<source-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="tcp://1.0.0.1:61616"/>
<property name="queue.sync.Trigger.gg" value="sync.Trigger.gg"/>
</source-context>
</source>
<target destination="SyncTriggerQueue"
connection-factory="java:/ConnectionFactory">
</target>
</jms-bridge>
<jms-bridge name="SyncTriggerOutBridge"
module="org.apache.activemq.artemis"
add-messageID-in-header="true"
max-batch-time="500"
max-batch-size="10"
max-retries="-1"
failure-retry-interval="30000"
quality-of-service="ONCE_AND_ONLY_ONCE">
<source destination="DlqSyncTriggerQueue"
connection-factory="java:/ConnectionFactory">
</source>
<target destination="dlq.sync.Trigger.gg"
connection-factory="ConnectionFactory"
user="appusertest"
password="appusertest">
<target-context>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="tcp://1.0.0.1:61616"/>
<property name="queue.dlq.sync.Trigger.gg" value="dlq.sync.Trigger.gg"/>
</target-context>
</target>
</jms-bridge>
</subsystem>
On the remote ActiveMQ Artemis cluster you may need to add anycastPrefix=jms.queue.;multicastPrefix=jms.topic. to the configuration of your acceptor which is listening on 61616.

ActiveMQ Artemis use-duplicate-detection causes AMQ214019: Invalid configuration: org.xml.sax.SAXParseException

Environment:
Ubuntu 20.04 LTS Server 64bit
OpenJDK 11.0.15
ActiveMQ Artemis 2.21.0
According to the clustering documentation I can use duplicate message detection in cluster-connection. However, because I don't need the cluster connection to detect duplicate messages I add <use-duplicate-detection>false</use-duplicate-detection> in the broker.xml.
When I run artemis-service start I get this error:
2022-07-31 18:52:02,335 ERROR [org.apache.activemq.artemis.core.client] AMQ214019: Invalid configuration: org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:activemq:core":use-duplicate-detection}'. One of '{"urn:activemq:core":max-hops, "urn:activemq:core":confirmation-window-size, "urn:activemq:core":producer-window-size, "urn:activemq:core":call-failover-timeout, "urn:activemq:core":notification-interval, "urn:activemq:core":notification-attempts, "urn:activemq:core":scale-down-connector, "urn:activemq:core":static-connectors, "urn:activemq:core":discovery-group-ref}' is expected.
at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:511) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3587) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1971) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:829) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:276) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:243) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:189) [java.xml:]
at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:108) [java.xml:]
at java.xml/javax.xml.validation.Validator.validate(Validator.java:124) [java.xml:]
at org.apache.activemq.artemis.utils.XMLUtil.validate(XMLUtil.java:361) [artemis-core-client-2.21.0.jar:]
Below is my broker.xml:
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
...
<cluster-user>cluster</cluster-user>
<cluster-password>cluster</cluster-password>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.8</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>artemis</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.8</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>artemis</connector-ref>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<use-duplicate-detection>false</use-duplicate-detection>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
...
</core>
</configuration>
Any suggestions?
The order of the elements actually matters because the ActiveMQ Artemis configuration XSD defines an xsd:sequence. Therefore, you should be using this:
<cluster-connection name="my-cluster">
<connector-ref>artemis</connector-ref>
<use-duplicate-detection>false</use-duplicate-detection>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>

ActiveMQ Artemis + JGroups + Getting OutOfMemory Error

I am using ActiveMQ Artemis 2.11.0 (having JGroups version 3.6.13) and run Artemis in a master/slave configuration. There are two masters and each master has a slave. Please find attached screenshot of OutOfMemory error.
I have tried to reproduce this issue but not able to reproduce it.
Please find below jgroups configuration:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:org:jgroups"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP loopback="true" recv_buf_size="${tcp.recv_buf_size:5M}"
send_buf_size="${tcp.send_buf_size:5M}" max_bundle_size="64K"
max_bundle_timeout="30" use_send_queues="true" sock_conn_timeout="300"
timer_type="new3" timer.min_threads="4" timer.max_threads="10"
timer.keep_alive_time="3000" timer.queue_max_size="500"
thread_pool.enabled="true" thread_pool.min_threads="2"
thread_pool.max_threads="8" thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="true" thread_pool.queue_max_size="10000"
thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="discard" />
<!-- a location that can be found by both server's running -->
<FILE_PING location="/opt/shared/fileping/artemis"
remove_all_files_on_view_change="true" />
<MERGE3 min_interval="60000" max_interval="90000" />
<FD_SOCK />
<FD_ALL timeout="30000" interval="15000"
timeout_check_interval="30000" />
<VERIFY_SUSPECT timeout="15000" />
<RSVP />
<pbcast.NAKACK2 use_mcast_xmit="false"
log_discard_msgs="false" max_rebroadcast_timeout="10000"
log_not_found_msgs="false" />
<UNICAST2 log_not_found_msgs="false" />
<pbcast.STABLE stability_delay="10000"
desired_avg_gossip="50000" max_bytes="4M" />
<pbcast.GMS print_local_addr="true" join_timeout="10000"
leave_timeout="10000" view_ack_collection_timeout="10000"
view_bundling="true" />
<UFC max_credits="2M" min_threshold="0.4" />
<FRAG2 frag_size="60K" />
<pbcast.STATE_TRANSFER />
master-broker.xml
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
<persistence-enabled>true</persistence-enabled>
<thread-pool-max-size>200</thread-pool-max-size>
<address-queue-scan-period>-1</address-queue-scan-period>
<journal-type>NIO</journal-type>
<paging-directory>${data.dir}/paging</paging-directory>
<bindings-directory>${data.dir}/bindings</bindings-directory>
<journal-directory>${data.dir}/journal</journal-directory>
<node-manager-lock-directory>${lock.dir}/artemis1-lock</node-manager-lock-directory>
<large-messages-directory>${data.dir}/large-messages</large-messages-directory>
<journal-datasync>true</journal-datasync>
<journal-min-files>50</journal-min-files>
<journal-pool-files>100</journal-pool-files>
<journal-file-size>10M</journal-file-size>
<page-max-concurrent-io>10</page-max-concurrent-io>
<journal-compact-min-files>150</journal-compact-min-files>
<journal-buffer-timeout>23480000</journal-buffer-timeout>
<journal-max-io>1</journal-max-io>
<disk-scan-period>5000</disk-scan-period>
<max-disk-usage>90</max-disk-usage>
<critical-analyzer>true</critical-analyzer>
<critical-analyzer-timeout>120000</critical-analyzer-timeout>
<critical-analyzer-check-period>60000</critical-analyzer-check-period>
<critical-analyzer-policy>LOG</critical-analyzer-policy>
<transaction-timeout>1800000</transaction-timeout>
<connectors>
<connector name="netty-connector">tcp://localhost:61616</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61616?anycastPrefix=jms.queue.;multicastPrefix=jms.topic.
</acceptor>
</acceptors>
<ha-policy>
<shared-store>
<master>
<failover-on-shutdown>true</failover-on-shutdown>
</master>
</shared-store>
</ha-policy>
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<broadcast-period>5000</broadcast-period>
<jgroups-file>jgroups.xml</jgroups-file>
<jgroups-channel>persistence-fs</jgroups-channel>
<connector-ref>netty-connector</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="my-discovery-group">
<jgroups-file>idsk-jgroups.xml</jgroups-file>
<jgroups-channel>persistence-fs</jgroups-channel>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="my-discovery-group" />
</cluster-connection>
</cluster-connections>
<cluster-user>admin</cluster-user>
<cluster-password>admin</cluster-password>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="amq" />
<permission type="deleteNonDurableQueue" roles="amq" />
<permission type="createDurableQueue" roles="amq" />
<permission type="deleteDurableQueue" roles="amq" />
<permission type="createAddress" roles="amq" />
<permission type="deleteAddress" roles="amq" />
<permission type="consume" roles="amq" />
<permission type="browse" roles="amq" />
<permission type="send" roles="amq" />
<permission type="manage" roles="amq" />
</security-setting>
</security-settings>
<address-settings>
<address-setting match="activemq.management#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>60000</redelivery-delay>
<max-delivery-attempts>5</max-delivery-attempts>
<max-size-bytes>50485760</max-size-bytes>
<page-size-bytes>10485760</page-size-bytes>
<message-counter-history-day-limit>10
</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>false</auto-create-addresses>
</address-setting>
<address-setting match="#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>60000</redelivery-delay>
<max-delivery-attempts>5</max-delivery-attempts>
<redistribution-delay>10000</redistribution-delay>
<max-size-bytes>50485760</max-size-bytes>
<page-size-bytes>10485760</page-size-bytes>
<message-counter-history-day-limit>10
</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>false</auto-create-addresses>
</address-setting>
</address-settings>
<addresses>
<address name="DLQ">
<anycast>
<queue name="DLQ" />
</anycast>
</address>
<address name="ExpiryQueue">
<anycast>
<queue name="ExpiryQueue" />
</anycast>
</address>
</addresses>
</core>
slave-broker.xml
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
<persistence-enabled>true</persistence-enabled>
<thread-pool-max-size>200</thread-pool-max-size>
<address-queue-scan-period>-1</address-queue-scan-period>
<journal-type>NIO</journal-type>
<paging-directory>${data.dir}/paging</paging-directory>
<bindings-directory>${data.dir}/bindings</bindings-directory>
<journal-directory>${data.dir}/journal</journal-directory>
<node-manager-lock-directory>${lock.dir}/artemis1-lock</node-manager-lock-directory>
<large-messages-directory>${data.dir}/large-messages</large-messages-directory>
<journal-datasync>true</journal-datasync>
<journal-min-files>50</journal-min-files>
<journal-pool-files>100</journal-pool-files>
<journal-file-size>10M</journal-file-size>
<page-max-concurrent-io>10</page-max-concurrent-io>
<journal-compact-min-files>150</journal-compact-min-files>
<journal-buffer-timeout>23480000</journal-buffer-timeout>
<journal-max-io>1</journal-max-io>
<server-dump-interval>60000</server-dump-interval>
<disk-scan-period>5000</disk-scan-period>
<max-disk-usage>90</max-disk-usage>
<critical-analyzer>true</critical-analyzer>
<critical-analyzer-timeout>120000</critical-analyzer-timeout>
<critical-analyzer-check-period>60000</critical-analyzer-check-period>
<critical-analyzer-policy>LOG</critical-analyzer-policy>
<transaction-timeout>1800000</transaction-timeout>
<connectors>
<connector name="netty-connector">tcp://localhost:61618</connector>
</connectors>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61618?anycastPrefix=jms.queue.;multicastPrefix=jms.topic.
</acceptor>
</acceptors>
<ha-policy>
<shared-store>
<slave>
<failover-on-shutdown>true</failover-on-shutdown>
<restart-backup>true</restart-backup>
<allow-failback>true</allow-failback>
</slave>
</shared-store>
</ha-policy>
<broadcast-groups>
<broadcast-group name="my-broadcast-group">
<broadcast-period>5000</broadcast-period>
<jgroups-file>idsk-jgroups.xml</jgroups-file>
<jgroups-channel>persistence-fs</jgroups-channel>
<connector-ref>netty-connector</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="my-discovery-group">
<jgroups-file>jgroups.xml</jgroups-file>
<jgroups-channel>persistence-fs</jgroups-channel>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<message-load-balancing>ON_DEMAND</message-load-balancing>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="my-discovery-group" />
</cluster-connection>
</cluster-connections>
<cluster-user>admin</cluster-user>
<cluster-password>admin</cluster-password>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="amq" />
<permission type="deleteNonDurableQueue" roles="amq" />
<permission type="createDurableQueue" roles="amq" />
<permission type="deleteDurableQueue" roles="amq" />
<permission type="createAddress" roles="amq" />
<permission type="deleteAddress" roles="amq" />
<permission type="consume" roles="amq" />
<permission type="browse" roles="amq" />
<permission type="send" roles="amq" />
<permission type="manage" roles="amq" />
</security-setting>
</security-settings>
<address-settings>
<address-setting match="activemq.management#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>60000</redelivery-delay>
<max-delivery-attempts>5</max-delivery-attempts>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>50485760</max-size-bytes>
<page-size-bytes>10485760</page-size-bytes>
<message-counter-history-day-limit>10
</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>false</auto-create-addresses>
</address-setting>
<!--default for catch all -->
<address-setting match="#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>60000</redelivery-delay>
<max-delivery-attempts>5</max-delivery-attempts>
<redistribution-delay>10000</redistribution-delay>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>50485760</max-size-bytes>
<page-size-bytes>10485760</page-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>false</auto-create-addresses>
</address-setting>
</address-settings>
</core>
Check if the cluster have started first, it can be an issue of UDP multicast, my friend one question the only shared directory you use is ther artemis1-lock??

Red Hat AMQ 7.1 broker- JMSSecurityException

javax.jms.JMSSecurityException: AMQ119213: User: epic does not have permission='CONSUME' for queue service_input on address service_input.service_input
In broker.xml have given the permission to user epic but still issue not resolved
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="amq"/>
<permission type="deleteNonDurableQueue" roles="amq"/>
<permission type="createDurableQueue" roles="amq, epic, guest"/>
<permission type="deleteDurableQueue" roles="amq,epic, guest"/>
<permission type="createAddress" roles="amq, epic, guest"/>
<permission type="deleteAddress" roles="amq, epic , guest"/>
<permission type="consume" roles="amq, epic , guest"/>
<permission type="browse" roles="amq, epic , guest"/>
<permission type="send" roles="amq, epic , guest"/>
<permission type="manage" roles="amq, epic , guest"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="epic.#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>-1</max-size-bytes>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>
</address-settings>
<addresses>
<address name="epic.PipelineEngine">
<anycast>
<queue name="execute_exchange" />
<queue name="service_exchange" />
<queue name="input_exchange" />
<queue name="unknown_exchange" />
<queue name="control_message_exchange" />
<queue name="notification_exchange" />
</anycast>
</address>
</addresses>

JBoss 7.2 jms messaging queue

We're running a standalone JBoss 7.2 on my localhost and using the standalone-full.xml
but in a lightweight version so that anything that isnt used is removed - for instance
the messaging sections were removed.
But now im trying to do a MessageDrivenBean with a queue by using the jms.
I started by adding following to the standalone-full.xml :
<extensions>
<extension module="org.jboss.as.messaging"/>
<subsystem xmlns="urn:jboss:domain:messaging:1.1">
<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"/>
</acceptors>
<security-domain>XXSecurityDomain</security-domain>
<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>
<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>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:100}">
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>
Next i used an existing servlet which was already working before, and modified it :
public class XRequestServlet extends HttpServlet
Context mQueueContext = null;
ConnectionFactory mConnectionFactory = null;
Connection mConnection = null;
public void init() throws ServletException {
try {
log.info("init()");
mQueueContext = new InitialContext();
mConnectionFactory = (ConnectionFactory) mQueueContext.lookup("/ConnectionFactory");
} catch (NamingException e) {
e.printStackTrace();
}
}
public void doPost(WebSession pWebSession, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
log.info("doPost()");
String vDestinationName = "java:jboss/exported/jms/queue/testQueue";
PrintWriter vOut = response.getWriter();
try {
log.info("1");
mConnection = mConnectionFactory.createConnection();
log.info("1.5");
Queue vQueue = (Queue) mQueueContext.lookup(vDestinationName);
log.info("2");
To test it i use a RESTClient plugin in firefox and i can see the my request
enters doPost() and i see logging doPost(), 1 and 1.5 but at trying to create
a queue fails.
In the jboss log i get following error :
javax.naming.NameNotFoundException: jms/queue/testQueue -- service jboss.naming.context.java.jboss.exported.jms.queue.testQueue
Can someone give me advice what needs to be done ??
I haven't reviewed the rest of your config, but the immediate cause of the error you are getting, is that you don't seem to have configured any queues in JBoss, so when you try to look it up using the mQueueContext.lookup the exception is thrown.
Queues are configured under jms-destinations like this:
<subsystem xmlns="urn:jboss:domain:messaging:1.0">
[...]
<jms-destinations>
<jms-queue name="testQueue">
<entry name="jms/queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
[...]
</subsystem>
See https://docs.jboss.org/author/display/AS72/Messaging+configuration#Messagingconfiguration-JMSQueuesandTopics for more documentation on setting up JMS under JBoss 7