Skip to content

Commit

Permalink
Merge branch 'additional_amqp_uri_parameters' of github.com:vilius-g/…
Browse files Browse the repository at this point in the history
…amqp091-go into additional_amqp_uri_parameters
  • Loading branch information
vilius-g committed Mar 2, 2024
2 parents 80d9353 + 4835984 commit 8871e92
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion _examples/pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ func publish(sessions chan chan session, messages <-chan message) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

pending := make(chan message, 1)

for session := range sessions {
var (
running bool
reading = messages
pending = make(chan message, 1)
confirm = make(chan amqp.Confirmation, 1)
)

Expand All @@ -117,6 +118,7 @@ func publish(sessions chan chan session, messages <-chan message) {
select {
case confirmed, ok := <-confirm:
if !ok {
pub.Close()
break Publish
}
if !confirmed.Ack {
Expand Down Expand Up @@ -190,6 +192,7 @@ func subscribe(sessions chan chan session, messages chan<- message) {
messages <- msg.Body
sub.Ack(msg.DeliveryTag, false)
}
sub.Close()
}
}

Expand Down

0 comments on commit 8871e92

Please sign in to comment.