Skip to content

Strange error when using WebSocketMessageBrokerConfigurer with embabel app #1203

@clojj

Description

@clojj

Adding spring-boot-starter-websocket dependency to an embabel application and this config:

@Configuration
@EnableWebSocketMessageBroker
class WebSocketBrokerConfig : WebSocketMessageBrokerConfigurer {

    override fun configureMessageBroker(registry: MessageBrokerRegistry) {
        registry.enableSimpleBroker("/topic")    // responses to clients
        registry.setApplicationDestinationPrefixes("/app") // client messages to server
    }

    override fun registerStompEndpoints(registry: StompEndpointRegistry) {
        registry.addEndpoint("/ws-chat")
            .setAllowedOrigins("*")
            .withSockJS()
    }

}

gives in this error:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncer' defined in class path resource [com/embabel/agent/spi/config/spring/AsyncConfiguration.class]: Unsatisfied dependency expressed through method 'asyncer' parameter 0: No qualifying bean of type 'java.util.concurrent.Executor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier("applicationTaskExecutor")}

Workaround was to create this bean:

@Bean(name = [TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME])
    @Qualifier(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME)
    fun applicationTaskExecutorVirtualThreads(builder: SimpleAsyncTaskExecutorBuilder): SimpleAsyncTaskExecutor? {
        return builder.build()
    }

I only created this issue, because using websockets seems to be a good option for an agent application for me.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions