【问题标题】:Publishing JMS message on Solace Topic在 Solace 主题上发布 JMS 消息
【发布时间】:2018-07-20 13:12:02
【问题描述】:

在 Solace 服务器主题上发布 JMS 消息时遇到问题。 实际上,我们可以使用 jmsTemplate.send() 方法成功发送消息。 但无法在 solace 客户端 GUI 上看到消息计数。 下面是我的安慰配置。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
                           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
                           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd">

    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:messaging.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="true" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>

    <!-- Solace Broker Configuration Details -->

    <bean id="solaceJndiTemplate" class="org.springframework.jndi.JndiTemplate"
        lazy-init="default" autowire="default">
        <property name="environment">
            <map>
                <entry key="java.naming.provider.url" value="${solace.url}" />
                <entry key="java.naming.factory.initial"
                    value="com.solacesystems.jndi.SolJNDIInitialContextFactory" />
                <entry key="java.naming.security.principal" value="${solace.userName}" />
                <entry key="java.naming.security.credentials" value="${solace.passWord}" />
            </map>
        </property>
    </bean>
    <bean id="solaceConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"
        lazy-init="default" autowire="default">
        <property name="jndiTemplate" ref="solaceJndiTemplate" />
        <property name="jndiName" value="${solace.jndiName}" />
    </bean>
    <!-- <bean id="solaceCachedConnectionFactory"
        class="org.springframework.jms.connection.CachingConnectionFactory">
        <property name="targetConnectionFactory" ref="solaceConnectionFactory" />
        <property name="sessionCacheSize" value="10" />
    </bean> -->
    <bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="solaceJndiTemplate" />
        <property name="jndiName" value="${solace.topic}" />
    </bean>

    <!-- <bean id="topicDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="solaceJndiTemplate" />
        <property name="jndiName" value="${solace.topic}" />
    </bean> -->

    <bean id="solaceQueueJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="solaceConnectionFactory" />
        <property name="defaultDestination" ref="destination" />
        <property name="deliveryPersistent" value="false" />
        <property name="explicitQosEnabled" value="true" />
         <property name="pubSubDomain" value="false"/>
    </bean>

    <bean id="solaceTopicJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="solaceConnectionFactory" />
        <property name="defaultDestination" ref="destination" />
        <property name="deliveryPersistent" value="false" />
        <property name="explicitQosEnabled" value="true" />
         <property name="pubSubDomain" value="true"/>
    </bean>

    <bean id="solaceQueueBroker" class="com.isc.common.messaging.SolaceUtilityHelper">
        <property name="jmsTemplate" ref="solaceQueueJmsTemplate" />
    </bean>

    <bean id="solaceTopicBroker" class="com.isc.common.messaging.SolaceUtilityHelper">
        <property name="jmsTemplate" ref="solaceTopicJmsTemplate" />
    </bean>

    <bean id="messageBroker" class="com.isc.common.messaging.SolaceUtilityHelper">
        <property name="activeBroker" value="${active.broker}" />
    </bean>


    <!-- <bean id="messageConsumer" class="com.isc.common.messaging.MessageConsumer">
    </bean>
    <bean id="jmsContainer"
        class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="solaceCachedConnectionFactory" />
        <property name="destination" ref="destination" />
        <property name="messageListener" ref="messageConsumer" />
    </bean> -->
</beans>

请任何人建议我解决这个问题。

提前致谢。 索拉布·马哈詹

【问题讨论】:

  • 你的 Spring 和 Solace 消息代理配置是什么?
  • 嗨@Russell Sim 我在问题部分添加了安慰配置。
  • 您使用哪个 JMS 模板进行发布? topicDestination 映射到 ${solace.topic}?是否还有另一个 bean id=messageConsumer 正在使用同一主题?
  • class="org.springframework.jndi.JndiTemplate 我们用于在 Solace 主题上发送消息的这个 JMS 模板。
  • @Rissell Sim 你能提供任何解决方案吗..

标签: publish jms-topic solace


【解决方案1】:

根据您的 cmets,您似乎正在发布到一个主题,但没有配置端点来假脱机消息。

您可以参考Adding Topic Subscriptions to Queues,了解有关如何配置队列以假脱机发布到主题的消息的详细信息。

要确认,您可以验证消息是否列在“无订阅匹配日志”下。在 SolAdmin 中,您可以通过前往“日志和诊断”并选择“无订阅匹配日志”来查看它们。对应的 CLI 命令是 show log no-subscription-match

此外,您的应用程序连接的统计信息还会显示接收和发送的消息数量,以及任何丢弃原因。这可以通过前往“客户”选项卡并选择“客户”视图来查看。然后,双击您的客户端并前往“统计信息”。或者,为此的 CLI 命令是 show client &lt;your-client-name&gt; message-vpn &lt;your-vpn-name&gt; stats

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-25
    • 2014-03-29
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多