Skip to content

Commit 43d11d7

Browse files
committed
Add settings to the stream queues
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
1 parent 56569af commit 43d11d7

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

pkg/rabbitmqamqp/entities.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@ func (a *AutoGeneratedQueueSpecification) buildArguments() map[string]any {
402402
}
403403

404404
type StreamQueueSpecification struct {
405-
Name string
406-
MaxLengthBytes int64
407-
InitialClusterSize int
408-
MaxAge time.Duration
409-
StreamMaxSegmentSize int64
410-
Arguments map[string]any
405+
Name string
406+
MaxLengthBytes int64
407+
InitialClusterSize int
408+
MaxAge time.Duration
409+
SegmentSize int64
410+
Arguments map[string]any
411411
}
412412

413413
func (s *StreamQueueSpecification) name() string {
@@ -444,8 +444,8 @@ func (s *StreamQueueSpecification) buildArguments() map[string]any {
444444
result["x-max-age"] = durationToMaxAge(s.MaxAge)
445445
}
446446

447-
if s.StreamMaxSegmentSize != 0 {
448-
result["x-stream-max-segment-size-bytes"] = s.StreamMaxSegmentSize
447+
if s.SegmentSize != 0 {
448+
result["x-stream-max-segment-size-bytes"] = s.SegmentSize
449449
}
450450

451451
result["x-queue-type"] = string(s.queueType())

pkg/rabbitmqamqp/entities_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ var _ = Describe("Entities", func() {
2323
})
2424

2525
Describe("StreamQueueSpecification", func() {
26-
It("should set x-stream-max-segment-size-bytes when StreamMaxSegmentSize is set", func() {
26+
It("should set x-stream-max-segment-size-bytes when SegmentSize is set", func() {
2727
spec := &StreamQueueSpecification{
28-
Name: "my-stream",
29-
StreamMaxSegmentSize: 500_000_000,
28+
Name: "my-stream",
29+
SegmentSize: 500_000_000,
3030
}
3131
args := spec.buildArguments()
3232
Expect(args["x-stream-max-segment-size-bytes"]).To(Equal(500_000_000))
3333
})
3434

35-
It("should not set x-stream-max-segment-size-bytes when StreamMaxSegmentSize is zero", func() {
35+
It("should not set x-stream-max-segment-size-bytes when SegmentSize is zero", func() {
3636
spec := &StreamQueueSpecification{Name: "my-stream"}
3737
args := spec.buildArguments()
3838
Expect(args).ToNot(HaveKey("x-stream-max-segment-size-bytes"))
@@ -55,9 +55,9 @@ var _ = Describe("Entities", func() {
5555

5656
It("should set both x-max-age and x-stream-max-segment-size-bytes together", func() {
5757
spec := &StreamQueueSpecification{
58-
Name: "my-stream",
59-
MaxAge: 30 * 24 * time.Hour,
60-
StreamMaxSegmentSize: 100_000_000,
58+
Name: "my-stream",
59+
MaxAge: 30 * 24 * time.Hour,
60+
SegmentSize: 100_000_000,
6161
}
6262
args := spec.buildArguments()
6363
Expect(args["x-max-age"]).To(Equal("1M"))

0 commit comments

Comments
 (0)