-
1. Re: WildFly 10.0.0 Final. How to configure pooled-connection-factory for multiple fixed addresses?
jbertram Oct 25, 2016 10:22 PM (in response to igilfanov)When a pooled-connection-factory is configured to connect to a remote WildFly 10.0.0 Final, it is possible to configure Message-Driven Beans (MDB) to have them consume messages from this remote server.
Yes.
If the decision involves bridges, it is possible to configure multiple bridges for single pooled-connection-factory?
If the decision involves JNDI-naming, it is possible to configure multiple JNDI for single pooled-connection-factory?
I'm not really sure what you're asking in either of these questions. Please elaborate. Describe your full use-case if possible.
-
2. Re: WildFly 10.0.0 Final. How to configure pooled-connection-factory for multiple fixed addresses?
igilfanov Oct 31, 2016 8:59 AM (in response to igilfanov)I found a solution:
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<external-context name="java:/global/RemoteServer" module="org.jboss.as.naming" class="javax.naming.InitialContext" cache="true">
<environment>
<property name="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
<property name="java.naming.provider.url" value="http-remoting://172.16.1.1:8080,http-remoting://172.16.1.2:8080"/>
<property name="java.naming.security.principal" value="jmsguest"/>
<property name="java.naming.security.credentials" value="jmsguest"/>
</environment>
</external-context>
<lookup name="java:global/ExportedQueue" lookup="java:/global/RemoteServer/jms/queue/MyQueue"/>
<lookup name="java:global/ExportedTopic" lookup="java:/global/RemoteServer/jms/topic/MyTopic"/>
<lookup name="java:global/ExportedFactory" lookup="java:/global/RemoteServer/jms/RemoteConnectionFactory"/>
</bindings>
<remote-naming/>
</subsystem>
- Sample Producer
public class MessageProducer {
@Inject
@JMSConnectionFactory("java:global/ExportedFactory")
@JMSPasswordCredential(userName = "jmsguest", password = "jmsguest")
private JMSContext context;
@Resource(lookup = "java:global/ExportedQueue")
private Queue queue;
- Sample Receiver
@MessageDriven(name = "MessageReceiver", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
@ActivationConfigProperty(propertyName= "connectionFactoryLookup", propertyValue = "java:global/ExportedFactory"),
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "java:global/ExportedTopic"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "user", propertyValue = "jmsguest"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "jmsguest")})
public class MessageReceiver implements MessageListener {
How to dispose:
@JMSPasswordCredential(userName = "jmsguest", password = "jmsguest")
and
@ActivationConfigProperty(propertyName = "user", propertyValue = "jmsguest"),
@ActivationConfigProperty(propertyName = "password", propertyValue = "jmsguest")
?
-
3. Re: WildFly 10.0.0 Final. How to configure pooled-connection-factory for multiple fixed addresses?
igilfanov Dec 1, 2016 3:19 AM (in response to igilfanov)this solution is unstable (does not always work):
1-Dec-2016 09:18:54.125 Caused By: javax.naming.NamingException: WFLYNAM0062: Filed to lookup ExportedQueue [Root exception is java.lang.RuntimeException: javax.naming.NamingException: Unable to invoke lookup, status=WAITING]
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:98)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
at org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:275)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:132)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:271)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:411)What could be wrong? And does not help option @JMSSessionMode(JMSContext.DUPS_OK_ACKNOWLEDGE)
Messages in the case of this exception is not re-sent.
@Stateless
public class SomeProducerBean {private static final Logger logger = LoggerFactory.getLogger(SomeProducerBean.class);
@Inject
@JMSConnectionFactory("java:global/ExportedFactory")@JMSSessionMode(JMSContext.DUPS_OK_ACKNOWLEDGE)
@JMSPasswordCredential(userName = "${VAULT::messaging::userName::1}", password = "${VAULT::messaging::password::1}")
private JMSContext jmsContext;
@Resource(lookup = "java:global/ExportedQueue")
private Destination requestQueue;
...
jmsContext.createProducer().setAsync(new CompletionListener() {
@Override
public void onCompletion(Message message) {logger.debug("Acked by server: message [{}], JMSCorrelationID: [{}]", message.toString(), jmsCorrelationID);
}
@Override
public void onException(Message message, Exception exception) {logger.error("Unable to send: message [{}], JMSCorrelationID: [{}]", message.toString(), jmsCorrelationID);
}
}).send(requestQueue, message);
...