ActiveMQ - client already connected with same clientId error - jboss

We have a setup of JBoss EAP 7.0.0.GA connecting to ActivMQ apache-activemq-5.14.3. We are trying to setup a durable subscriber with the following configuration:
#MessageDriven(
name = "TestListener",
activationConfig = {
#ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
#ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "Durable"),
#ActivationConfigProperty(propertyName = "subscriptionName",
propertyValue = "subscriptionNameTest"),
#ActivationConfigProperty(propertyName = "clientId",
propertyValue = "2"),
#ActivationConfigProperty(propertyName = "destination",
propertyValue = "jms/testTopic")
}
)
#PermitAll
#ResourceAdapter(value="activemq-rar.rar")
However, we are getting the following exception in the JBoss server console
ERROR [org.apache.activemq.ra.ActiveMQEndpointWorker] (default-threads - 4) Failed to connect to broker [tcp://127.0.0.1:61616?jms.rmIdFromConnectionId=true]: Broker: TestBroker - Client: 2 already connected from tcp://127.0.0.1:64246: javax.jms.InvalidClientIDException: Broker: TestBroker - Client: 2 already connected from tcp://127.0.0.1:64246
At the same time if we see the following logs at the activmq :
WARN | Failed to add Connection ID: 40600-51:1 due to javax.jms.InvalidClientIDException: Broker: TestBroker - Client: 2 already connected from tcp://127.0.0.1:64246 | org.apache.activemq.broker.TransportConnection | ActiveMQ Transport: tcp:///127.0.0.1:50170#61616
The ActiveMQManagedConnectionFactory settings are as follows (tried setting the max-pool-size to 1, but to no effect):
/subsystem=resource-adapters/resource-adapter=activemq-rar.rar/connection-definitions=ConnectionFactory:add(class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory", jndi-name="java:/MyConnectionFactory", enabled=true, min-pool-size=1, max-pool-size=20, pool-prefill=false, same-rm-override=false, recovery-username=ejb_user, recovery-password=xxxxx)
Request help from AMQ experts please.

only way I have been able to get AMQ and jboss to behave without a thousand threads doing stupid things is to setup the RAR with an embedded broker and then network connect the embedded broker with your external broker.

Perhaps, changing your property/configuration would solve your issue.
Try for example to change your client id by using the following configuration:
#ActivationConfigProperty(propertyName="clientId", propertyValue = "2-${jboss.node.name}")
This will ensure that your clientId is unique

Related

Kafka Message loss when Kafkaserver goes down

I have a scenario that when Kafka server or Zookeeper both goes down, but the producer application trying to send a message to Kafka broker.
When the Kafka broker or Zookeeper comes online, messages is getting loss, and i see the producer delivery result offset has Offset: -1001 and Partition [Any]
Below are my configuration to reproduce
new ProducerConfig
{
BootstrapServers = <BROKET_END_POINT>,
MessageMaxBytes = 20971520,
MessageCopyMaxBytes = 20971520,
LogConnectionClose = false,
BrokerAddressFamily = BrokerAddressFamily.V4,
ConnectionsMaxIdleMs = 0,
//https://github.com/Azure/azure-event-hubs-for-kafka/issues/139
SocketKeepaliveEnable = true,
MetadataMaxAgeMs = 180000,
//https://learn.microsoft.com/en-us/azure/event-hubs/apache-kafka-configurations
RequestTimeoutMs = 60000,
MessageTimeoutMs = 0,
MessageSendMaxRetries = int.MaxValue,
RetryBackoffMs = 100,
EnableIdempotence = true,
Acks = Acks.All,
BatchSize = 2000000,
LingerMs = 0,
CompressionType = CompressionType.Gzip
SocketNagleDisable = true
};
I used the above setting to produce the message using Confluent kafka nuget package version 1.8.2 from .Net code.
Appreciate your inputs in advance

JBoss EAP 6.4.2 is not listening from multiple remote servers

I am having a problem setting MDB to listen to multiple remote servers on JBoss EAP 6.4.2 with Windows OS. When I set 2 servers to listen on connectionParameters it's getting messages from only one of them.
If I set only one server to listen it works well. But can't listen to 2 or more server at the same time. following is my MDB
#MessageDriven(mappedName = "TestTopicRemote", activationConfig = {
#ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "cacheTopic"),
#ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory,org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),
#ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=172.16.116.32;port=5445,host=172.16.116.107;port=5445"),
#ActivationConfigProperty(propertyName = "user", propertyValue = "guest"),
#ActivationConfigProperty(propertyName = "password", propertyValue = "password1")}
)
I believe you have misunderstood the functionality provided by the connectionParameters activation configuration property and MDB functionality in general. A JMS MDB in JBoss EAP cannot directly receive messages from multiple brokers.
The connectionParameters activation configuration property supports multiple entries, but only one will actually be used. Typically the entries are for all the servers in a cluster or the master & slave of an HA pair.
Are the Artemis brokers running on 172.16.116.32 and 172.16.116.107 part of a cluster? If so, consumers connecting to any node in the cluster should be able to receive messages produced to any other node in the cluster assuming the brokers in the cluster have the appropriate configuration.

Bridge startup error connecting to Zookeeper

Just getting the following error trying to setup the Bridge component using Zookeeper, according to the steps described in https://docs.corda.r3.com/website/releases/3.1/bridge-configuration-file.html?highlight=zookeeper.
> java -jar corda-bridgeserver-3.1.jar
BridgeSupervisorService: active = false
[ERROR] 20:59:31-0300 [main-EventThread] imps.EnsembleTracker.processConfigData - Invalid config event received: {server.1=10.102.32.104:2888:3888:participant, version=100000000, server.3=10.102.32.108:2888:3888:participant, server.2=10.102.32.107:2888:3888:participant}
[ERROR] 20:59:32-0300 [main-EventThread] imps.EnsembleTracker.processConfigData - Invalid config event received: {server.1=10.102.32.104:2888:3888:participant, version=100000000, server.3=10.102.32.108:2888:3888:participant, server.2=10.102.32.107:2888:3888:participant}
My bridge.conf:
bridgeMode = BridgeInner
outboundConfig {
artemisBrokerAddress = "10.102.32.97:10010"
alternateArtemisBrokerAddresses = [ "10.102.32.98:10010" ]
}
bridgeInnerConfig {
floatAddresses = ["10.102.32.103:12005", "10.102.32.105:12005"]
expectedCertificateSubject = "CN=Float Local,O=Local Only,L=London,C=GB"
customSSLConfiguration {
keyStorePassword = "bridgepass"
trustStorePassword = "trustpass"
sslKeystore = "./bridgecerts/bridge.jks"
trustStoreFile = "./bridgecerts/trust.jks"
crlCheckSoftFail = true
}
}
haConfig {
haConnectionString = "zk://10.102.32.104:2181,zk://10.102.32.107:2181,zk://10.102.32.108:2181"
}
networkParametersPath = ./network-parameters
Any thoughts?
This error is harmless. It indicates that the Dockerised Zookeeper has bad IP addresses, so when the Apache Curator is sent the dynamic topology, some checks fail. It does not invalidate the static configuration and everything should work fine.
Note that as of Corda Enterprise 3.2, you must use the Zookeeper version that is compatible with the Apache Curator library, which is 3.5.3-beta, and NOT the latest version.

What is the Jboss4 xml configuration equivalent of ActivationConfigProperty?

I have an MDB deployed nicely within JBoss-4.0.4 with this annotation. It works very well.
#MessageDriven(
activationConfig = {
#ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination",
propertyValue = "queue/mycompany/thing/thingy"),
#ActivationConfigProperty(propertyName = "MaxPoolSize",
propertyValue = "4")
}
)
Now I need to externalise that configuration so I can change MaxPoolSize without having to recompile and redeploy the code. According to the docs it looks this should appear in the standardjboss.xml as a new <proxy-factory-config> but what value should I use for <JMSProviderAdapterJNDI>, <ServerSessionPoolFactoryJNDI> etc? Is this change (adding a new <proxy-factory-config> element) the only thing I need?
<proxy-factory-config>
<JMSProviderAdapterJNDI>WHATGOESHERE?</JMSProviderAdapterJNDI>
<ServerSessionPoolFactoryJNDI>WHATGOESHERE?</ServerSessionPoolFactoryJNDI>
<MaximumSize>3</MaximumSize>
<MaxMessages>1</MaxMessages>
<MDBConfig>
<ReconnectIntervalSec>10</ReconnectIntervalSec>
<DLQConfig>
<DestinationQueue>queue/mycompany/thing/thingy</DestinationQueue>
<MaxTimesRedelivered>10</MaxTimesRedelivered>
<TimeToLive>0</TimeToLive>
</DLQConfig>
</MDBConfig>
</proxy-factory-config>

How to map a websphere mq 7 queue to a EJB 3 destinationName

I need to map WebSphere MQ7 queue (Say queA in Queue Manager QMA) to a EJB3 MDB.
I created the MQ Queue Manager and Queue using
crtmqm QMA and start it using strmqm MQA
Then i wrote a file file name QMA.conf and included
DEFINE QLOCAL ('queA')
line it and run the command
runmqsc QMA < QMA.conf
then I run
strmqcsv MQA &
runmqlsr -m QMA -t TCP &
All these steps done as mqm logged user.
Then I follow
http://community.jboss.org/wiki/JBossEAP5IntegrationwithWebSphereMQ
link and configure RAR to the jboss 5.1. When I run the test connection that also succeeded.
There I include
* channel - SYSTEM.DEF.SVRCONN
* hostName - localhost
* port - 1414
* queueManager - ExampleQM
* transportType - CLIENT
and In my MDB I include
#MessageDriven( name="WMQMDBTest",
activationConfig =
{
#ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),
#ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "queA"),
#ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
#ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),
#ActivationConfigProperty(propertyName = "hostName", propertyValue = "localhost"),
#ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QMA"),
#ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),
#ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT"),
#ActivationConfigProperty(propertyName = "username", propertyValue = "mqm"),
#ActivationConfigProperty(propertyName = "password", propertyValue = "password")
})
#TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
#ResourceAdapter(value = "wmq.jmsra.rar")
When I try to deploy the bean it says
DEPLOYMENTS IN ERROR:
Deployment "jboss.j2ee:ear=integration-1.0-SNAPSHOT.ear,jar=business-logic-1.0-SNAPSHOT.jar,
name=WMQMDBTest,service=EJB3" is in error due to the following reason(s):
javax.naming.NameNotFoundException: queA not bound
You've written
#ActivationConfigProperty(propertyName = "destination", propertyValue = "queA"),
#ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),
with the useJNDI property implying that 'queA' is the name under which the JMS Queue is bound into the JNDI namespace - this does not directly correspond to the queue you have defined here
DEFINE QLOCAL ('queA')
If you want it to refer to a physical WMQ queue on your queue manager then you need the useJNDI property set to false, in which case destination specifies the name of a queue on the queue manager, not a JNDI name. On the other hand, if you do want to use JNDI lookup of Destinations then you need to ensure that the destination name specified matches the Queue definition in the -ds.xml file, e.g.
#ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/request")
would correspond to
<mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=request_queue">
<attribute name="JNDIName">jms/request</attribute>
<depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=QMA
baseQueueName=queA
</attribute>
</mbean>
note the JNDIName attribute of the mbean corresponds to the destination name