Skip to content

Commit 2fd1d06

Browse files
committed
set message durable as default
releaded to rabbitmq/rabbitmq-server#13918 Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent 07ec51d commit 2fd1d06

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

pkg/rabbitmqamqp/amqp_publisher_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ var _ = Describe("AMQP publisher ", func() {
243243
Expect(dc.Message().Header.Durable).To(BeTrue())
244244
Expect(dc.Accept(context.Background())).To(BeNil())
245245

246-
msgNotPersistent := NewMessageWithPersistence([]byte("hello"), false)
246+
msgNotPersistent := NewMessage([]byte("hello"))
247+
msgNotPersistent.Header = &amqp.MessageHeader{
248+
Durable: false,
249+
}
247250
publishResult, err = publisher.Publish(context.Background(), msgNotPersistent)
248251
Expect(err).To(BeNil())
249252
Expect(publishResult).NotTo(BeNil())

pkg/rabbitmqamqp/messages_helper.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ func NewMessage(body []byte) *amqp.Message {
3030
return amqp.NewMessage(body)
3131
}
3232

33-
// NewMessageWithHeader creates a new AMQP 1.0 message with the given payload and sets the persistence to the given value.
34-
// The persistence is set by setting the Header.Durable property to true or false.
35-
36-
func NewMessageWithPersistence(body []byte, persistence bool) *amqp.Message {
37-
m := amqp.NewMessage(body)
38-
m.Header = &amqp.MessageHeader{
39-
Durable: persistence,
40-
}
41-
return m
42-
}
43-
4433
// NewMessageWithAddress creates a new AMQP 1.0 new message with the given payload and sets the To property to the address of the target.
4534
// The target must be a QueueAddress or an ExchangeAddress.
4635
// This function is a helper that combines NewMessage and MessagePropertyToAddress.

0 commit comments

Comments
 (0)