-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package mq | ||
|
||
import ( | ||
amqp "github.com/rabbitmq/amqp091-go" | ||
) | ||
|
||
// RabbitMQHeaderCarrier adapts http.Header to satisfy the TextMapCarrier interface. | ||
type RabbitMQHeaderCarrier amqp.Table | ||
|
||
// Get returns the value associated with the passed key. | ||
func (hc RabbitMQHeaderCarrier) Get(key string) string { | ||
return hc.Get(key) | ||
} | ||
|
||
// Set stores the key-value pair. | ||
func (hc RabbitMQHeaderCarrier) Set(key string, value string) { | ||
hc.Set(key, value) | ||
} | ||
|
||
// Keys lists the keys stored in this carrier. | ||
func (hc RabbitMQHeaderCarrier) Keys() []string { | ||
keys := make([]string, 0, len(hc)) | ||
for k := range hc { | ||
keys = append(keys, k) | ||
} | ||
return keys | ||
} |