Skip to content

AbstractBedrockApi Streaming reusing of Flux Sink #474

@timograw

Description

@timograw

I was using a single instance bean of chatClient and starting with the second call to the stream method i got an exception "java.lang.IllegalStateException: Unicast Sinks.Many allows only a single Subscriber". I am not sure if this is a bug or intended behaviour.
I'm new to Flux, but i think this happens because the Flux is always created from the same Sink instance in AbstractBedrockApi.internalInvocationStream()
I'm proxying controller calls sp i've added web request scope @scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS) to the BedrockAnthropicChatClient bean, that fixed my use case.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions