Skip to content

Commit

Permalink
[Protocol] Add guidance to send CloseProducer before sending Producer…
Browse files Browse the repository at this point in the history
… in case of client side timeout (apache#12948)
  • Loading branch information
michaeljmarshall authored and fangxiaobing committed Dec 19, 2021
1 parent b74a31c commit a46a3a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions site2/docs/developing-binary-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ messages to the broker, referring to the producer id negotiated before.

![Producer interaction](assets/binary-protocol-producer.png)

If the client does not receive a response indicating producer creation success or failure,
the client should first send a command to close the original producer before sending a
command to re-attempt producer creation.

##### Command Producer

```protobuf
Expand Down Expand Up @@ -276,6 +280,11 @@ When receiving a `CloseProducer` command, the broker will stop accepting any
more messages for the producer, wait until all pending messages are persisted
and then reply `Success` to the client.

If the client does not receive a response to a `Producer` command within a timeout,
the client must first send a `CloseProducer` command before sending another
`Producer` command. The client does not need to await a response to the `CloseProducer`
command before sending the next `Producer` command.

The broker can send a `CloseProducer` command to client when it's performing
a graceful failover (eg: broker is being restarted, or the topic is being unloaded
by load balancer to be transferred to a different broker).
Expand Down
9 changes: 9 additions & 0 deletions site2/website-next/docs/developing-binary-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ messages to the broker, referring to the producer id negotiated before.

![Producer interaction](/assets/binary-protocol-producer.png)

If the client does not receive a response indicating producer creation success or failure,
the client should first send a command to close the original producer before sending a
command to re-attempt producer creation.

##### Command Producer

```protobuf
Expand Down Expand Up @@ -285,6 +289,11 @@ When receiving a `CloseProducer` command, the broker will stop accepting any
more messages for the producer, wait until all pending messages are persisted
and then reply `Success` to the client.

If the client does not receive a response to a `Producer` command within a timeout,
the client must first send a `CloseProducer` command before sending another
`Producer` command. The client does not need to await a response to the `CloseProducer`
command before sending the next `Producer` command.

The broker can send a `CloseProducer` command to client when it's performing
a graceful failover (eg: broker is being restarted, or the topic is being unloaded
by load balancer to be transferred to a different broker).
Expand Down

0 comments on commit a46a3a9

Please sign in to comment.