-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: close producer when topic is deleted #4147
base: master
Are you sure you want to change the base?
Conversation
43c2c9e
to
66461d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right approach. This should work for all client not just CLI. client should detect if topic is closed then close connection
@@ -39,6 +39,7 @@ producer-file-io = ["fluvio-cli-common/file-records"] | |||
[dependencies] | |||
async-channel = { workspace = true } | |||
async-trait = { workspace = true } | |||
async-std = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't bring in async-std
.
Make sense! But the producer is never what is blocking. #[connector(source)]
async fn start(config: CustomConfig, producer: TopicProducerPool) -> Result<()> {
let source = TestJsonSource::new(&config)?;
let mut stream = source.connect(None).await?;
while let Some(item) = stream.next().await {
println!("producing a value: {}", &item);
producer.send(RecordKey::NULL, item).await?;
}
Ok(())
} Maybe we can change TopicProducerPool to detect an error when the topic is deleted and also add a method to detect it, but we will also need to add something like Another solution that I had is have a method that receives a stream and returns a stream that handles it. async fn from_stream(stream: GenericStream) -> ProducerStream But we will need to change implementations too: #[connector(source)]
async fn start(config: CustomConfig, producer: TopicProducerPool) -> Result<()> {
let source = TestJsonSource::new(&config)?;
let mut stream = source.connect(None).await?;
while let Some(item) = producer.from_stream(stream).await {
println!("producing a value: {}", &item);
producer.send(RecordKey::NULL, item).await?;
}
Ok(())
} What do you think? |
Is cluster side socket already closed by the SPU? I think that's the first thing to handle for this case. In addition, if possible it would be nice for the SPU to send a message that the produce stream is being closed due to topic delete, and then close the spu side socket. |
Yeah, I think so. The SPU already send a But I think that we will have the same problem. All usage of producer seems to be:
The I think that this issue aims to be notified before the input. |
Stale pull request message |
Related: #3836
We already close the consumer when the topic is deleted, now we will close the producer too.
Given:
When:
Then:
Topic "my-topic" was deleted