Skip to content

Commit

Permalink
check super stream creation (#355)
Browse files Browse the repository at this point in the history
and deletion when the broker is less 3.13.0

Signed-off-by: Gabriele Santomaggio <[email protected]>
  • Loading branch information
Gsantomaggio authored Sep 25, 2024
1 parent d3ecf25 commit 6365fdb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/stream/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,10 @@ func (c *Client) StreamStats(streamName string) (*StreamStats, error) {

func (c *Client) DeclareSuperStream(superStream string, options SuperStreamOptions) error {

if !c.availableFeatures.is313OrMore {
return fmt.Errorf("declaring super stream via client API not supported, server version is less than 3.13.0")
}

if superStream == "" || containsOnlySpaces(superStream) {
return fmt.Errorf("super Stream Name can't be empty")
}
Expand Down Expand Up @@ -1084,6 +1088,11 @@ func (c *Client) DeclareSuperStream(superStream string, options SuperStreamOptio
}

func (c *Client) DeleteSuperStream(superStream string) error {

if !c.availableFeatures.is313OrMore {
return fmt.Errorf("deleting super stream not supported via client API, server version is less than 3.13.0")
}

length := 2 + 2 + 4 + 2 + len(superStream)
resp := c.coordinator.NewResponse(commandDeleteSuperStream, superStream)
correlationId := resp.correlationid
Expand Down

0 comments on commit 6365fdb

Please sign in to comment.