使用下面的代码,我正在尝试向其他应用程序发送消息。在 Tomcat 中,工作正常 - 发送的消息等于在 jconsole 中接收的消息。但是当我在 weblogic 中部署时,发现发送的消息计数与 jconsole 中的接收计数不匹配意味着丢失了一些消息。
@ManagedResource
public class OBSNotificationPublisher{
@Autowired
private MessageChannel channel;
Message <?> message = MessageBuilder.withPayload( obj ).setHeader(JmxHeaders.NOTIFICATION_TYPE, notficationType ).build();<br>
channel.send( message );
}
**applicationcontext.xml**
<?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:context="http://www.springframework.org/schema/context"
xmlns:si="http://www.springframework.org/schema/integration"
xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/jmx
http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd">
<context:mbean-server/>
<context:mbean-export/>
<si:message-history/>
<si:channel id="channel"/>
<jmx:notification-publishing-channel-adapter
id="adapter" channel="channel"
object-name="obs.jmx.publisher:name=obsNotificationPublisher"
default-notification-type="default.type">
</jmx:notification-publishing-channel-adapter>
<bean id="obsNotificationPublisher" class="com.obs.eas.jmx.publisher.OBSNotificationPublisher" />
</beans>
以下是使用的 weblogic 服务器参数:
-Dweblogic.wsee.skip.async.response=true -Dcom.sun.management.jmxremote.port=6666 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.autodiscovery=true -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder
这里有人可以帮助我为什么错过了一些放在频道中的消息吗?每次运行的缺失计数都是随机的。提前致谢。