Ibm mq 使用webspheremq的EhCache复制

Ibm mq 使用webspheremq的EhCache复制,ibm-mq,ehcache,Ibm Mq,Ehcache,是否可以在IBM的Websphere MQ 7.0中使用JMS上的EHCache复制?我有一个使用ActiveMQ(开箱即用)的工作示例,但不确定如何配置EHCache以使用webspheremq 下面是我为ActiveMQ工作的ehcache.xml和ActiveMQInitialContextFactory配置的示例 _______________________________ActiveMQ示例_____________________________ ehcache.xml <!

是否可以在IBM的Websphere MQ 7.0中使用JMS上的EHCache复制?我有一个使用ActiveMQ(开箱即用)的工作示例,但不确定如何配置EHCache以使用webspheremq

下面是我为ActiveMQ工作的ehcache.xml和ActiveMQInitialContextFactory配置的示例

_______________________________ActiveMQ示例_____________________________

ehcache.xml

<!-- ActiveMQ configuration out of the box -->
<cacheManagerPeerProviderFactory
    class="net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory"
    properties="initialContextFactoryName=com.hcsc.contextfactory.ActiveMQContextFactory,
        providerURL=tcp://LJGO4RAJ:61616,
        replicationTopicConnectionFactoryBindingName=topicConnectionFactory,
        getQueueConnectionFactoryBindingName=queueConnectionFactory,
        getQueueBindingName=ehcache,
        listenToTopic=true,
        replicationTopicBindingName=ehcache"
    propertySeparator="," />

<cache name="distributedCache" maxEntriesLocalHeap="1000"
    eternal="true" overflowToDisk="false">
    <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.jms.JMSCacheReplicatorFactory"
     properties="replicateAsynchronously=true, 
                     replicatePuts=true,
                     replicateUpdates=true,
                     replicateUpdatesViaCopy=true,
                  replicateRemovals=true,                                                asynchronousReplicationIntervalMillis=500"
        propertySeparator="-" />

</cache>

我相信我将需要一个MQQueueConnectionFactory,类似于我为ActiveMQ创建的MQQueueConnectionFactory,我的方向正确吗?我找不到任何示例代码来实现这一点

只是一个问题。。你为什么要这么做?是不是因为某些原因您不能使用RMI复制?噢。。大问题。我只想说,我曾在一些使用EHCache和RMI复制的大型系统上工作过。我认为这是最快的复制协议。然而,也有一个缺点,即“自动对等发现”开箱即用要求使用多播TCP。但是,您可以通过手动告诉集群中的每个成员所有其他对等点的位置,或者编写自己的发现代码(我有一些示例)来解决这个问题。@Richard Yep我正在使用Spring。我认为在这一点上我会信任您,因为我发现Websphere的JMS实现相当麻烦。我只浏览了EHCaches文档中的RMI规范。这种方法是否需要使用任何代理服务,如ActiveMQ、Websphere、OpenMQ等。?很抱歉提出这个高层次的问题,但我只是好奇。如果您使用的是Spring。。。。。(吸一口气)多年来,春天一直回避分配问题,把它留给了我们。但他们最近已经着手解决这一缺陷。我还没有查出来,但你可能会想:从表面上看,他们似乎已经确定了某种令人敬畏的redis解决方案。。但你永远不知道这可能正是你所需要的?但如果您需要有关EHCache的任何帮助。。如果可以的话。。我可能做过。。那就问吧,我帮你挖点东西。。
public class ActiveMQContextFactory extends ActiveMQInitialContextFactory {

@Override
public Context getInitialContext(Hashtable environment)
        throws NamingException {

    Map<String, Object> data = new ConcurrentHashMap<String, Object>();

    // Configure the Topic connection factory binding name
    String factoryBindingName = (String) environment
            .get(JMSUtil.TOPIC_CONNECTION_FACTORY_BINDING_NAME);
    try {
        data.put(factoryBindingName, createConnectionFactory(environment));
    } catch (URISyntaxException e) {
        throw new NamingException("Error initialisating ConnectionFactory"
                + " with message " + e.getMessage());
    }

    String topicBindingName = (String) environment
            .get(JMSUtil.REPLICATION_TOPIC_BINDING_NAME);
    data.put(topicBindingName, createTopic(topicBindingName));

    // Configure queue connection factory binding name
    String getQueueConnectionfactoryBindingName = (String) environment
            .get(JMSUtil.GET_QUEUE_CONNECTION_FACTORY_BINDING_NAME);

    if (getQueueConnectionfactoryBindingName != null) {
        try {
            data.put(getQueueConnectionfactoryBindingName,
                    createConnectionFactory(environment));
        } catch (URISyntaxException e) {
            throw new NamingException(
                    "Error initialisating TopicConnectionFactory with message "
                            + e.getMessage());
        }
    }

    String getQueueBindingName = (String) environment
            .get(JMSUtil.GET_QUEUE_BINDING_NAME);
    if (getQueueBindingName != null) {
        data.put(getQueueBindingName, createQueue(getQueueBindingName));
    }

    return createContext(environment, data);
}

}
<cacheManagerPeerProviderFactory
    class="net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory"
    properties="initialContextFactoryName=com.hcsc.contextfactory.WebSphereMQContextFactory,
        providerURL=tcp://LJGO4RAJ:1415,
        replicationTopicConnectionFactoryBindingName=topicConnectionFactory,
        getQueueConnectionFactoryBindingName=queueConnectionFactory,
        getQueueBindingName=myqueue,
        listenToTopic=true,
        replicationTopicBindingName=ehcache"
    propertySeparator="," />

<cache name="distributedCache" maxEntriesLocalHeap="1000"
    eternal="true" overflowToDisk="false">
    <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.jms.JMSCacheReplicatorFactory"
        properties="replicateAsynchronously=true, 
                                            replicatePuts=true,
                                            replicateUpdates=true,
                                            replicateUpdatesViaCopy=true,
                                            replicateRemovals=true,
                                            asynchronousReplicationIntervalMillis=500"
        propertySeparator="-" />

</cache>
public class WebSphereMQContextFactory extends MQQueueConnectionFactory {

// TODO - NOT SURE HOW TO CONFIGURE THIS FOR EHCACHE?

}