我想做一些由Camunda流程实例状态变化触发的工作,因此我为Camunda编写了一个Spring注释驱动的事件侦听器。
我已经将它打包到一个JAR文件中: code和pom.xml位于Gist here中。
我已经编写了一个扩展camunda/camunda-bpm-platform:run-7.14.0的Dockerfile,并将生成的JAR插入到/camunda/configuration/userlib中。
根据ps的说法,这肯定在Spring引导加载程序路径中
10 camunda 0:31 java -Dloader.path=/camunda/internal/webapps/,/camunda/internal/rest/,/camunda/configuration/userlib/,/camunda/configuration/keystore/ -Dcamunda.deploymentDir=/camunda/configuration/resources -jar /camunda/internal/camunda-bpm-run-core.jar --spring.config.location=file:/camunda/configuration/default.yml查看日志,Camunda肯定会触发Spring eventing:
o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-001: Initialized Camunda Spring Boot Eventing Engine Plugin.
o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-003: Task events will be published as Spring Events.
o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-005: Execution events will be published as Spring Events.
o.c.b.s.b.s.event.EventPublisherPlugin : EVENTING-007: History events will be published as Spring events.但是我看不到我的日志消息。
这让我怀疑,简单地将一个JAR放到加载器上并不足以让Spring Boot找到监听器--但我不知道我还遗漏了什么。
任何帮助都将不胜感激。谢谢!
发布于 2021-01-09 00:09:24
好吧,我意识到我在这里做错了什么。我错误地假设类路径上的任何JAR文件都会自动初始化它们的类,这反过来意味着Spring将注意到@Component和@EventListener注释,然后...使用一些魔术来添加侦听器。这不是真的。
我现在明白了,正确的做法是使用Camunda Initializr构建一个全新的Spring Boot应用程序,其中包括我的侦听器,然后使用Docker。这就是我现在要走的路。
https://stackoverflow.com/questions/65600260
复制相似问题