JMS-bridge configuration not sharing a load on both hornetQ server - jms

I have tried to configure HornetQ server-side load-balancing using JMS bridge. I am using Wildfly 9, and I have done following configuration on standalone-ha.xml file but it is not sharing load between two server. Server running properly but message goes on only one instance.
<jms-bridge name="myBridge">
<source>
<connection-factory name="ConnectionFactory"/>
<destination name="jms/queue/MyQueue"/>
</source>
<target>
<connection-factory name="jms/RemoteConnectionFactory"/>
<destination name="jms/queue/MyQueue"/>
<context>
<property key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
<property key="java.naming.provider.url" value="http-remoting://192.168.102.33:9090"/>
</context>
</target>
<quality-of-service>AT_MOST_ONCE</quality-of-service>
<failure-retry-interval>1000</failure-retry-interval>
<max-retries>-1</max-retries>
<max-batch-size>2</max-batch-size>
<max-batch-time>100</max-batch-time>
<add-messageID-in-header>true</add-messageID-in-header>
</jms-bridge>
I have read JBoss article for the same but it is not give proper solution for problem. Any one suggest what is the issue here? How can we solve this issue please suggest?

A JMS bridge is a simple mechanism to move messages from a "source" to a "destination". It has nothing to do with server-side load-balancing. If you want server-side load-balancing you need to configure clustering.

Related

Hazelcast with spring namespace - init the node when context is loaded

i have hazelcast instance defined using the hazelcast name space and a map in it. also using spring cache abstraction to define cacheManager.
<bean name="siteAdminPropertyPlaceHolderConfigurer"
class="org.sample.SiteAdminPropertyPlaceHolderConfigurer">
<property name="order" value="1000"/>
<!-- last one-->
</bean>
<!-- hazelcast cache manager -->
<hz:hazelcast id="instance" lazy-init="true">
<hz:config>
<hz:group name="${HAZEL_GROUP_NAME}" password="${HAZEL_GROUP_PASSWORD}"/>
<hz:network port="${HAZEL_NETWORK_PORT}" port-auto-increment="true">
<hz:join>
<hz:multicast enabled="${HAZEL_MULTICAST_ENABLED}"
multicast-group="224.2.2.3"
multicast-port="54327"/>
<hz:tcp-ip enabled="${HAZEL_TCP_ENABLED}">
<hz:members>${HAZEL_TCP_MEMBERS}</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
<hz:map name="oauthClientDetailsCache"
backup-count="1"
max-size="0"
eviction-percentage="30"
read-backup-data="true"
eviction-policy="NONE"
merge-policy="com.hazelcast.map.merge.PassThroughMergePolicy"/>
</hz:config>
</hz:hazelcast>
<bean id="hazelcastCacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager" lazy-init="true"
depends-on="instance">
<constructor-arg ref="instance"/>
</bean>
The problem is that ,this spring context is also used for other tools we have besides the server and that hazelcast starts listening on the port and the tool actually never exit.
i tried to disable all network join (enabled=false) and i though to enable them programatically only when the server starts. but it does not work hazelcast still starts.
i don't want to give up the spring name space as its very convenient for developers to define new maps(spring caches). also i want as little hazelcast code in there.
any idea how to achieve this ?
thanks
Shlomi
I didn't find a way to do this except telling hazecast to shutdown at the end of each tool run.
i also moved the definition above to separated XML context file so it would not be loaded by the tools (at least not all of them)
Hazelcase.shutdownAll();

how to connect multiple redis instances through spring data redis?

I am trying to connect multiple redis instances via spring. But I did not find any documentation.
Here is how I am using it currently. I am using Jedis as the client and I plan on using Jedis only as I might require support for sentinel.
<bean id="jedisConnFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name ="hostName" value ="localhost"/>
<property name="port" value="6379" />
</bean>
<bean id="stringRedisSerializer"
class="org.springframework.data.redis.serializer.StringRedisSerializer" />
<!-- redis template definition -->
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="jedisConnFactory"
p:keySerializer-ref="stringRedisSerializer"
p:hashKeySerializer-ref="stringRedisSerializer"
p:ValueSerializer-ref="stringRedisSerializer" />
I want to add multiple redis instances to the connection pool. Like..
<property name ="hosts" value ="localhost:6379,localhost:6380"/>
After researching , I found, there is no support for client side partitioning currently in spring-data-redis.
In future the partitioning technique in redis shall move to redis-cluster permanently.
At present, To use partition along with spring-data-redis, the best way is to use twemproxy and point JedisConnectionFactory host and port to twemproxy.
In case you're looking for support of JedisSentinelPool then have a look at does-spring-data-redis-1-3-2-release-support-jedissentinelpool-of-jedis.

WSO2 CEP IBM MQ and transport.jms.ConcurrentConsumers

I have a WSO2 CEP configured with Input Event Adaptor set to listen on a IBM WebSphere MQ queue. Below there is a conf in xml:
<inputEventAdaptor name="WEBSPHEREMQ" statistics="disable" trace="disable" type="jms" xmlns="http://wso2.org/carbon/eventadaptormanager">
<property name="java.naming.provider.url">file:/opt/bindings</property>
<property name="transport.jms.SubscriptionDurable">false</property>
<property name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</property>
<property name="transport.jms.ConnectionFactoryJNDIName">MQ_JMS_MANAGER</property>
<property name="transport.jms.DestinationType">queue</property>
</inputEventAdaptor>
and an event builder with queue set:
<from eventAdaptorName="WEBSPHEREMQ" eventAdaptorType="jms">
<property name="transport.jms.Destination">MSCRM_IN_JMS_QUEUE</property>
</from>
I want to increase transport.jms.ConcurrentConsumers to speed up CEP performance results. Where do I need to put this parameter? I have tried in event adaptor and in event builder but it doesn't work.
Thanks a lot for any help!:)
Peter
Sorry at the moment, there is no any way to pass this property out of the box to jms adaptor. But I strongly believe this is a good addition for jms adaptor. We are doing some improvements related to this by aiming next release.. I have created a jira [1] to track this..
[1] https://wso2.org/jira/browse/CEP-884
you have two option at the moment, improve the current input jms adaptor by fixing in the source or write a custom jms adaptor for you need..
Thanks,Mohan

file inbound adapter Multiple threads processing same file

We have a spring integration application which will monitor on an incoming folder then process the files. I was using prevent-duplicates="true" but I have to change to false.
Here I explained the reason.
file inbound-channel-adapter performance issue
Now I am seeing multiple threads processing same file. I appreciate help!
<file:inbound-channel-adapter id="inFiles" channel="inFilesin" directory="file:${incoming.folder}"
queue-size="300" filename-regex="(?i)^(?!.*writing)" prevent-duplicates="false" auto-startup="true" auto-create-directory="false" >
<int:poller id="fw.fileInboudPoller" fixed-rate="1" receive-timeout="3" time-unit="SECONDS"
max-messages-per-poll="10" task-executor="taskExecutor" />
</file:inbound-channel-adapter>
<task:executor id="taskExecutor" pool-size="10-20" queue-capacity="20" rejection-policy="CALLER_RUNS" />
Thanks,
Mohan
As you have found, there are difficulties scaling, when a filesystem has a very large number of files.
You might want to consider alternative technologies, Rabbit, JMS, etc.
Alternatively, you can implement a custom file locker or directory scanner as described here.
The provided nio-locker won't help because it doesn't prevent multi-threaded access in this case.

hibernate.cfg.xml fails to reload with Tomcat/Spring 2

I'm using an older Spring 2 application with Tomcat and Hibernate. I was under the impression that I could change some settings in hibernate.cfg.xml, restart Tomcat, and the new settings (like a database connection) would take effect. Yet the old settings persist. What do I have to do to make these new changes go through? Here is an example of the xml:
<property name="connection.username">career</property>
<property name="connection.url">jdbc:oracle:thin:#192.168.76.46:1521:ISDD</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="myeclipse.connection.profile">my-careers</property>
<property name="connection.password">farcri</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
Let me know if more information is required.
i am not sure what your new settings are.Anyway they should be found.do you want to change database from one provider to oracle.Please put your tomcat output..You can do one thing that include log4j jar files so that you can see what tomcat is doing in detail manner.i think you are using myeclipse..do project clean such things..go to project and right click then do refresh..do close myeclipse and start again.
Hope this helps to you to figure out your problem.
As it turns out, hibernate.cfg.xml was not being read by the application. Instead, the database connection settings were placed in the ROOT.xml file in localhost. Not sure why this would be advantageous. Here is the relevant section of the ROOT.xml file:
<Resource name="jdbc/careers" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:#192.168.76.55:1521:ISDD"
username="career" password="farcri" maxActive="20" maxIdle="10"
maxWait="-1"/>

Resources