Spring integration support for Clustered/high availability IBM MQ manager - spring-integration

I am using spring integration to connect with the IBM MQ. My spring integration application is connecting successfully with IBM MQ. Now the MQ team made the MQ manager as the clustered manager i.e. queue manager is containing 2 host one active and one passive because if one host is down the passive one will up and running.
Below is my spring integration configuration for MQ and I can pass only one host.
<bean id="mqQueueConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostName" value=""/>
<property name="port" value=""/>
<property name="channel" value=""/>
<property name="queueManager" value=""/>
<property name="transportType" value="1"/>
</bean>
Is there any way by which we can pass both the active and passive host's from the configuration. I tried with the comma in host but that is not supported .
Please suggest

You should specify the hosts under the property connectionNameList, don't use hostName and port.
http://www-01.ibm.com/support/docview.wss?uid=swg21397867
Multi Instance MQ set up

The ConnectionNameList will allow to pass the active and passive host
<bean id="mqQueueConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="connectionNameList" value="activeHost(port),passiveHost(port)"/>
<property name="channel" value="channel Name"/>
<property name="queueManager" value="Queue Manager name"/>
<property name="transportType" value="transport type"/>
</bean>

Related

Outbound-channel-adapter/Spring JMS starting too many MQ connections

I am using jms:outbound-channel-adapter.
We noticed that application server is starting way too many MQ connections. Application ultimately exhausts the maxChannel limit of MQ Server and starts getting :
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2537' ('MQRC_CHANNEL_NOT_AVAILABLE')
I am using MQTopicConnectionFactory, CachingConnectionFactory, outbound-channel-adapter.
Current configuration:
<bean id="mqQueueConnectionFactory" class="com.ibm.mq.jms.MQTopicConnectionFactory">
<property name="SSLCipherSuite" value="${mq.sslCipherSuite}"/>
<property name="hostName" value="${mq.hostName}"/>
<property name="port" value="${mq.port}"/>
<property name="channel" value="${mq.channel}"/>
<property name="transportType" value="1"/>
</bean>
<bean id="cachedConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory"
p:targetConnectionFactory-ref="jmsTConnectionFactory"
p:reconnectOnException="true" p:sessionCacheSize="10"
p:cacheProducers="true" />
<bean id="senderTopic" class="com.ibm.mq.jms.MQTopic" >
<constructor-arg value="${mq.topicName}"/>
</bean>
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="cachedConnectionFactory" />
</property>
<property name="defaultDestination">
<ref bean="senderTopic" />
</property>
</bean>
Outbound-channel-adapter:
<int-jms:outbound-channel-adapter
id="jmsOutToNE" channel="umpAlertNotificationJMSChannel"
destination="senderTopic" jms-template="jmsQueueTemplate">
<!-- <int:retry-advice/> -->
</int-jms:outbound-channel-adapter>
Spring integration flow having 250 concurrent threads, however, there are 2000+ MQ connections starting during peak load.
What is the significance of sessionCacheSize="10" in CachingConnectionFactory if the connections are exceeding 500?
How can I limit the MQ connections?
Can't JMS reuse the MQ connection from the a pool the way DB connections work?

In Spring LDAP, what happens when a pooled connection fails to successfully connect?

I am using Spring LDAP (2.0.2.RELEASE) to interact with our AD environment. I have integrated pooling within my applicationContext.xml.
In the Java LDAP docs (section 3.4), it states
If the LDAP provider cannot establish a connection within that period, it aborts the connection attempt
My question is: does spring handle a retry for this connection, or is there an error that occurs/thrown? I know Spring utilizes many of the underlying JVM LDAP features, but I have yet to find anything specific in this area.
Pertinent pieces of my applicationContext:
<bean id="dirContextValidator" class="org.springframework.ldap.pool.validation.DefaultDirContextValidator" />
<bean id="exampleConnectionDetails" class="org.springframework.ldap.core.support.LdapContextSource" scope="singleton">
<property name="url" value="ldaps://ldap.example.com:636" />
<property name="userDn" value="CN=LDAP_User,DC=example,DC=com" />
<property name="password" value="superSecretPwd" />
<property name="pooled" value="false"/>
<property name="referral" value="follow"/>
</bean>
<bean id="exampleContextSource" class="org.springframework.ldap.pool.factory.PoolingContextSource">
<property name="contextSource" ref="exampleConnectionDetails" />
<property name="dirContextValidator" ref="dirContextValidator" />
<property name="testOnBorrow" value="true" />
<property name="testWhileIdle" value="true" />
<property name="maxWait" value="10000" />
<property name="whenExhaustedAction" value="0" />
<property name="minIdle" value="5" />
<property name="maxIdle" value="10" />
<property name="timeBetweenEvictionRunsMillis" value="15000" />
<property name="minEvictableIdleTimeMillis" value="30000" />
<property name="numTestsPerEvictionRun" value="7" />
</bean>
The documentation for testOnBorrow states this,
testOnBorrow: The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and an attempt to borrow another will be made.
I understand, Spring will attempt to make another connection in the event of an failure.

Spring Integration auto reconnect to IBM MQ thru JBOSS Resource Adapter

We are using Spring Integration in our project and we have a requirement where If IBM MQ goes down then we will have to auto connect to IBM MQ when it is up. We have done this implementation using recoveryInterval option of org.springframework.jms.listener.DefaultMessageListenerContainer class. We have given recovery interval value to try to recover the MQ connection. But it is not recovering the connection after MQ restart. Below was my existing configuration:
<jms:message-driven-channel-adapter id="adapterId" channel="raw-channel" container="messageListenerContainer" />
<bean id="messageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="customQueueCachingConnectionFactory" />
<property name="destination" ref="requestQueue" />
<property name="recoveryInterval" value="60000" />
</bean>
Below is the Current Connection Factory :
<bean id="queueCachingConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="queueConnectionFactory" />
<property name="sessionCacheSize" value="10" />
<property name="cacheProducers" value="false" />
<!-- <property name="reconnectOnException" value="true" /> -->
<!-- <property name="exceptionListener" ref="MQExceptionListener"></property> -->
</bean>
<jee:jndi-lookup id="queueConnectionFactory" jndi-name="MQConnectionFactory"
expected-type="javax.jms.ConnectionFactory" lookup-on-startup="true"></jee:jndi-lookup>
<jee:jndi-lookup id="queue" jndi-name="Queue"
expected-type="javax.jms.Queue" lookup-on-startup="true"/>
ERROR [task-scheduler-4] LoggingHandler:145 -org.springframework.jms.IllegalStateException: MQJCA1019: The connection is closed.; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: MQJCA1019: The connection is closed.
The application attempted to use a JMS connection after it had closed the connection.
Modify the application so that it closes the JMS connection only after it has finished using the connection.
Thanks in Advance!!
The default message listening container should reference the caching connection factory:
<!-- caching connection factory fascade, also implements exception listener -->
<bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="connectionFactory"/>
<property name="sessionCacheSize" value="10"/>
<property name="reconnectOnException" value="true"/>
</bean>
<!-- this is the Message Driven POJO (MDP) -->
<bean id="messageDrivenPOJO" class="com.redhat.gss.spring.MessageDrivenPOJO" />
<!-- The message listener container -->
<bean id="messageListener" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="sessionTransacted" value="true"/>
<property name="concurrentConsumers" value="1"/>
<property name="cacheLevelName" value="CACHE_CONSUMER"/>
<property name="receiveTimeout" value="10000"/>
<property name="sessionAcknowledgeMode" value="2"/>
<property name="messageListener" ref="messageDrivenPOJO"/>
<property name="connectionFactory" ref="cachingConnectionFactory"/>
<property name="exceptionListener" ref="cachingConnectionFactory"/>
<property name="destination" ref="jbossQueue"/>
</bean>

Does GridGain support SSL connection between each cluster member?

Does GridGain support SSL connection between each cluster member? If yes, can you show me how to do that?
Thanks,
Bill
GridGain supports SSL only for client connections (GridGain provides .NET and C++ thin clients), but not for communication between nodes.
To enable SSL for client connections, configure your server nodes like this:
<bean id="grid.cfg" class="org.gridgain.grid.GridConfiguration">
<!-- Enable REST. -->
<property name="restEnabled" value="true"/>
<!-- Client connection configuration. -->
<property name="clientConnectionConfiguration">
<bean class="org.gridgain.grid.GridClientConnectionConfiguration">
<!-- Enable SSL. -->
<property name="restTcpSslEnabled" value="true"/>
<!-- Provide SSL context factory (required). -->
<property name="restTcpSslContextFactory">
<bean class="org.gridgain.client.ssl.GridSslBasicContextFactory">
<property name="keyStoreFilePath" "keystore/server.jks"/>
<property name="keyStorePassword" value="123456"/>
<property name="trustStoreFilePath" "keystore/trust.jks"/>
<property name="trustStorePassword" value="123456"/>
</bean>
</property>
</bean>
</property>
</bean>
You will also need to provide SSL context factory on client configuration.
Ignite (and GridGain) allows you to use SSL for all possible connections.
To use SSL connection between nodes define property sslContextFactory in IgniteConfiguration.
<bean id="cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="sslContextFactory">
<bean class="org.apache.ignite.ssl.SslContextFactory">
<property name="keyStoreFilePath" value="keystore/server.jks"/>
<property name="keyStorePassword" value="123456"/>
<property name="trustStoreFilePath" value="keystore/trust.jks"/>
<property name="trustStorePassword" value="123456"/>
</bean>
</property>
</bean>
You can also check official security documentation.
https://apacheignite.readme.io/docs/ssltls

When I try to start Hazelcast Managment Center, it fails to start

I am trying to Hazelcast 3.2.4 Management Center to start up in TC Server 3.2.4 Tomcat 7. But even though it seems to start without errors in the logs, I can't access the page:
In Tomcat.log I can see
Line 203004: INFO: Deploying web application archive /vc2cmmkb019231n/app/pm13/process-1.3-build317/instances/vm1/webapps/mancenter-3.2.4.war
Line 203016: INFO: notifyApplicationLifecycle(localhost|mancenter-3.2.4)[START]
Line 203018: WARNING: handleStartEvent(localhost|mancenter-3.2.4)[START] failed (ConnectException) to send ping: No current registered listener
Line 204206: INFO: notifyApplicationLifecycle(localhost|mancenter-3.2.4)[STOP]
that indicates that mancenter has started and stopped, but when I try to access the web page:
http://my-host-name:8080/mancenter-3.2.4/
it doesn't load up.
I am using the following hazelcast spring configuration:
<bean id="hcMonitorInstance" class="com.hazelcast.core.Hazelcast" destroy-method="shutdown" factory-method="newHazelcastInstance">
<constructor-arg>
<bean class="com.hazelcast.config.Config">
<property name="instanceName" value="hcMonitorInstanceConfig"/>
<property name="groupConfig">
<bean class="com.hazelcast.config.GroupConfig">
<property name="name" value="${px-monitor-monitor.com.hazelcast.config.GroupConfig.name}"/>
<property name="password" value="${px-monitor-monitor.com.com.hazelcast.config.GroupConfig.password}"/>
</bean>
</property>
<property name="networkConfig">
<bean class="com.hazelcast.config.NetworkConfig">
<property name="join" ref="join"/>
<property name="port" value="${px-monitor-monitor.hazelcastInstanceConfig.port}"/>
<property name="portAutoIncrement" value="true"/> <!--THIS is FALSE in CIWS-->
<property name="interfaces">
<bean class="com.hazelcast.config.InterfacesConfig">
<property name="interfaces">
<list>
<value>*</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
<property name="managementCenterConfig">
<bean class="com.hazelcast.config.ManagementCenterConfig">
<property name="enabled" value="${hz.management.center.enabled}"/>
<property name="url" value="${hz.management.center.url}"/>
</bean>
</property>
</bean>
</constructor-arg>
</bean>
Any Ideas on why it won't start up? I have also looked in Catalina.out for errors, but none show up. I've also tried hitting http://my-host:8080/mancenter/ but that doesn't work either. I can see the web app expanded in tomcat webapps folder and it looks to be correct.
Run java -version. If it is 1.8.0_91 then that's the culprit. Following is what you do
point to an older version of java (1.6 or 1.7 are fine) executable to run the mancenter; something similar to java -jar mancenter-3.6.2.war 8200 mancenter; I ran it on port 8200 so as to not conflict with existing app running on 8080
that should bring up the mancenter; create the admin user
now you should be able to start your 'normal' java version (1.8.0_91 most likely)
It appears the problem occurs with java 1.8.0_91 when no user has been created. Let me know if this worked.

Resources