I am using the java sdk of temporal with below maven dependency
<dependency>
<groupId>io.temporal</groupId>
<artifactId>temporal-sdk</artifactId>
<version>1.8.1</version>
</dependency>
I noticed that one worker only assigned to the task queue of workflow implementation type, and so I tried to increase the workers registered to workflow implementation type registered to the task queue, but I failed to do that and I got this exception below
example code is :
Worker worker = workerFactory.newWorker(âexample_task_queueâ);
worker.registerWorkflowImplementationTypes(ExampleWorkflowImpl.class);
exception got :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name âExampleWorkflowImplâ defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/com/example/workflow/impl/ExampleWorkflowImpl.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: ExampleWorkflowImpl workflow type is already registered with the worker
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:610)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:582)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at com.example.ExampleWorkflowImpl.main(ExampleWorkflowImpl.java:26)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.IllegalStateException: ExampleWorkflowImpl workflow type is already registered with the worker
at io.temporal.internal.sync.POJOWorkflowImplementationFactory.registerWorkflowImplementationType(POJOWorkflowImplementationFactory.java:196)
at io.temporal.internal.sync.POJOWorkflowImplementationFactory.registerWorkflowImplementationTypes(POJOWorkflowImplementationFactory.java:104)
at io.temporal.internal.sync.SyncWorkflowWorker.registerWorkflowImplementationTypes(SyncWorkflowWorker.java:138)
at io.temporal.worker.Worker.registerWorkflowImplementationTypes(Worker.java:223)
at ai.applica.spring.boot.starter.temporal.processors.WorkflowAnnotationBeanPostProcessor.postProcessAfterInitialization(WorkflowAnnotationBeanPostProcessor.java:128)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:437)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)