- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Spring Integration 创建一个简单的 JMS 生产者。任何人都可以帮我解释为什么我收到“Dispatcher 没有订阅者”错误吗?
我在本地使用 ActiveMQ,并且基于我的 ActiveMQ 日志,队列和 session 都是在我运行测试应用程序时创建的。但是没有消息进来。
我的spring-integration-config.xml
<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:51515"/>
</bean>
</property>
<property name="sessionCacheSize" value="10"/>
<property name="cacheConsumers" value="false"/>
</bean>
<bean id="hwQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="hello_world_channel"/>
</bean>
<integration:channel id="hwOutboundChannel"/>
<jms:message-driven-channel-adapter id="hwOutboundAdapter" destination="hwQueue" connection-factory="jmsConnectionFactory"
channel="hwOutboundChannel"/>
<integration:gateway id="hwOutboundGateway" service-interface="com.veeva.mc.sisandbox.service.SiGateway"
default-request-channel="hwOutboundChannel"/>
SiGateway.java
public interface SiGateway {
void send(String message);
}
测试代码
@SpringBootApplication
@EnableIntegration
public class SiSandboxApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SiSandboxApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
"spring-integration-config.xml");
SiGateway gateway = (SiGateway) context.getBean("hwOutboundGateway");
gateway.send("Hello World");
context.close();
}
}
错误堆栈跟踪
2019-04-11 18:04:37.362 DEBUG 9170 --- [ main] faultConfiguringBeanFactoryPostProcessor :
Spring Integration global properties:
spring.integration.endpoints.noAutoStartup=
spring.integration.taskScheduler.poolSize=10
spring.integration.channels.maxUnicastSubscribers=0x7fffffff
spring.integration.channels.autoCreate=true
spring.integration.channels.maxBroadcastSubscribers=0x7fffffff
spring.integration.readOnly.headers=
spring.integration.messagingTemplate.throwExceptionOnLateReply=false
2019-04-11 18:04:37.362 DEBUG 9170 --- [ main] .s.i.c.GlobalChannelInterceptorProcessor : No global channel interceptors.
2019-04-11 18:04:37.363 INFO 9170 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2019-04-11 18:04:37.363 INFO 9170 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'org.springframework.context.support.ClassPathXmlApplicationContext@1af05b03.errorChannel' has 1 subscriber(s).
2019-04-11 18:04:37.363 INFO 9170 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
2019-04-11 18:04:37.363 INFO 9170 --- [ main] ProxyFactoryBean$MethodInvocationGateway : started hwOutboundGateway
2019-04-11 18:04:37.363 INFO 9170 --- [ main] o.s.i.gateway.GatewayProxyFactoryBean : started hwOutboundGateway
2019-04-11 18:04:37.364 INFO 9170 --- [ main] ishingJmsMessageListener$GatewayDelegate : started org.springframework.integration.jms.ChannelPublishingJmsMessageListener$GatewayDelegate@56febdc
2019-04-11 18:04:37.552 INFO 9170 --- [ main] o.s.i.jms.JmsMessageDrivenEndpoint : started hwOutboundAdapter
2019-04-11 18:04:37.561 DEBUG 9170 --- [ main] o.s.integration.channel.DirectChannel : preSend on channel 'hwOutboundChannel', message: GenericMessage [payload=Hello World, headers={id=58f33457-fa61-553c-3e9d-525784a2c199, timestamp=1555031077560}]
2019-04-11 18:04:37.564 INFO 9170 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-11 18:04:37.572 ERROR 9170 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:816) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:797) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:324) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at t.h.w.sisandbox.SiSandboxApplication.main(SiSandboxApplication.java:20) [classes/:na]
Caused by: org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.context.support.ClassPathXmlApplicationContext@1af05b03.hwOutboundChannel'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers, failedMessage=GenericMessage [payload=Hello World, headers={id=58f33457-fa61-553c-3e9d-525784a2c199, timestamp=1555031077560}]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:461) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:401) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187) ~[spring-messaging-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166) ~[spring-messaging-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109) ~[spring-messaging-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:151) ~[spring-messaging-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:143) ~[spring-messaging-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.integration.gateway.MessagingGatewaySupport.send(MessagingGatewaySupport.java:413) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:533) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:473) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:463) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at com.sun.proxy.$Proxy55.send(Unknown Source) ~[na:na]
at t.h.w.sisandbox.SiSandboxApplication.run(SiSandboxApplication.java:29) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813) [spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
... 5 common frames omitted
Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:138) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) ~[spring-integration-core-5.1.4.RELEASE.jar:5.1.4.RELEASE]
... 22 common frames omitted
2019-04-11 18:04:37.576 INFO 9170 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2019-04-11 18:04:37.576 INFO 9170 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'application.errorChannel' has 0 subscriber(s).
最佳答案
根据您的配置,您不做 JMS 生产者,<jms:message-driven-channel-Adapter
是 JMS 消费者。请阅读他们的文档:https://docs.spring.io/spring-integration/docs/5.1.4.RELEASE/reference/html/#jms .
对于生产者,您需要使用 jms:outbound-channel-Adapter
反而。
这正是您出现该异常的原因,因为您通过网关向没有订阅者的 channel 发送消息。你的<jms:message-driven-channel-Adapter
当一条消息出现在该 JMS 目标上时,将执行相同的操作。
关于java - 如何修复简单消息生成器的 "Dispatcher has no subscribers"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55643135/
我的密码 https://gist.github.com/ButuzGOL/707d1605f63eef55e4af 因此,当我收到登录成功回调时,我想进行重定向, 重定向也可以通过调度程序进行。 我
我已经写了访问者模式如下,但我不明白什么是单次和双次分派(dispatch)。AFAIK,单分派(dispatch)是根据调用者类型调用方法,而双分派(dispatch)是根据调用者类型和参数类型调用
我有一个非 ui 线程,我需要在该线程上发送消息。 执行此操作的正常方法是在我的线程的线程过程中调用 Dispatcher.Run()。 我想修改它以使其在处理未处理的异常方面更加健壮。 我的第一个剪
我有一个具有这样功能的代码 const mapDispatchToProps = (dispatch: Dispatch) => ({ onAddProduct: ( key: str
我在使用 Window.Show 显示 WPF 窗口时遇到问题: System.InvalidOperationException was unhandled Message: An unhandle
我对何时使用 Dispatcher.Invoke 从不同线程更新 UI 上的某些内容存有疑问。 这是我的代码... public Window4() { InitializeC
我遇到了一个我无法解决的问题。我正在构建一个电子商务 react 应用程序并使用 useReducer 和 useContext 进行状态管理。客户打开产品,挑选商品数量,然后单击“添加到购物车”按钮
尽管我已经深入了解了 NEventStore 上的事务完整性,但我无法理解在连接了许多 NEventStore 实例时 NEventStore 将如何真正扩展。 总结一下我的理解,一个事件被添加到提交
我学习了 React Javascript 和 Redux,现在我遇到了这个问题。 这是一个 codesandbox 像这样尝试: 搜索书名“dep” 观察日志显示“Search url is:”,当
Dispatcher.CurrentDispatcher(在System.Windows.Threading中)和Application.Current.Dispatcher(在 >系统.Window
我得到了一些代码来处理调度程序在其构造函数中传递给 View 模型的位置。我现在想知道当我想要在 UI 线程上执行某些操作时,我是否应该使用 ObserveOn(dispatcher) 或 dispa
当我们的一个应用程序服务器内存不足时,我正在分析 Java 堆转储。我正在使用 Eclipse 内存分析器。它报告了以下内容。 One instance of "akka.dispatch.Dispa
哪一个: public static let barrier: DispatchWorkItemFlags public static let detached: DispatchWorkItem
我想使用不同于调度类型的类型提示 Action 创建者。 我已经尝试使用这两种类型对 ThunkResult 进行类型提示,但这并不理想。 // types.ts interface AppListA
我正在尝试准确地理解什么是单次分派(dispatch)和多次分派(dispatch)。 我刚刚读到这个: http://en.wikipedia.org/wiki/Multiple_dispatch
I have following api returning Flux of String我有以下返回字符串通量的接口 @GetMapping(value = "/api/getS
这是我自学前端开发一年后在Stackoverflow上的第一个问题。我已经找到了我的疑惑的答案,但由于这些问题是第三次返回,我认为是时候向 Web 提问了。 我正在尝试构建什么 我正在尝试构建一个图书
我正在使用 Kotlin 学习 Android,并且我了解到在不阻塞主线程的情况下启动协程的推荐方法是执行以下操作 MainScope().launch { withContext(Dispatc
错误本身: (alias) deleteCategory(id: number): (dispatch: Dispatch) => void import deleteCategory Argumen
我必须对抽屉进行裁剪,然后创建一个包含所有需要项的DrawerComponent,并创建一个带有NavigationActions的函数来调度我的路线,但是它不起作用。当我单击任何项目时,我都会遇
我是一名优秀的程序员,十分优秀!