Comments (9)
Metadata are strings because almost all of Pub/Subs are supporting only simple types for metadata. So the main thing that we need to keep is to make amqp.Marshaler
transparent, so you can make multiple Pub/Subs pipelines.
So to solve it and keep backward compatibility we can make custom marshaling of x-death
to string. What values it contains? Some ints? And do you know about any other headers in rabbit which are not string?
Unfortunately it will not work for all non-string headers, but the question is that is there any default non-string headers? If someone have something custom, he should probably to implement custom marshaller.
from watermill.
Until now it's the only one that makes problems, my example value (dump by spew):
([]interface {})[
(amqp.Table)map[
time:(time.Time)2019-04-16 18:50:19 +0000 UTC
count:(int64)642
exchange:(string)TEST.E.Fanout.xxx.Worker.DL
queue:(string)TEST.Q.xxx.Worker.DL
reason:(string)expired
routing-keys:([]interface {})[(string)TEST.Q.xxx.Worker]
]
(amqp.Table)map[
count:(int64)642
exchange:(string)
queue:(string)TEST.Q.xxx.Worker
reason:(string)rejected
routing-keys:([]interface {})[(string)TEST.Q.xxx.Worker]
time:(time.Time)2019-04-16 18:49:49 +0000 UTC
]
]
from watermill.
OK, custom marshaler works for me, thanks.
But nevertheless watermill shouldn't fail on standard headers ;)
from watermill.
But nevertheless watermill shouldn't fail on standard headers ;)
Yup, it is not so good :)
I have couple ideas how it can be fixed, but nothing sounds good:
- Using gob to marshal Rabbit's metadata to message metadata, but it will break all string headers
- Storing some metada fields in ctx, but if someone will overwrite ctx we will lose this information
- We can use for some "special" metadata fields (maybe some prefix in name) which will serialized with gob, to keep compatibility with simple string fields. All other fields will be not marshaled.
- We can make explicit blacklist of ignored fields, but we will lose transparency
But 3 and 4 sounds most reasonable. What do you think?
from watermill.
clarifying 3:
- normal headers will be strings like currently
- complex types will be gob'ed and key will be something like:
x-death__gob
?
If you mean something like that, I like that :)
from watermill.
Exactly :)
from watermill.
Does anyone know how many data types of a header can be other than string, in Golang context and AMQP context?
from watermill.
Does anyone know how many data types of a header can be other than string, in Golang context and AMQP context?
I think I found how each AMQP type is mapped to a Go type. https://github.com/rabbitmq/amqp091-go/blob/5c9eb2241d43a1d2ff3ae0c98b7153a38625973d/read.go#L142-L159
I think gob cannot be used in this case because it is possible for an AMQP type to be mapped to nil in Go, and gob cannot encode nil values.
from watermill.
Hi I am encountering this issue as well. Im using the delayed message plugin for amqp and also quorum type queues. These functionalities respectively utilize the "x-delay" and add the "x-delivery-count" keys with a numeric value.
Adding a prefix will break the functionality of the "x-delay" value and is not possible for the "x-delivery-count" header that is added by amqp itself, or am I misunderstanding the solution?
from watermill.
Related Issues (20)
- How to subscribe to all gochannel ? HOT 2
- Any plans to add support of RabbitMQ Streaming?
- Generated topic names for PubSub tests does not conform with Azure guidelines
- How to delete message after ack? HOT 1
- Context not being propagated through command bus HOT 2
- Is it possible to get google pubsub server generated unique message-id? HOT 3
- Data race on Publish for Google pubsub
- SQLite driver HOT 4
- Log custom fields inside message router
- Invalid publisher name in metrics
- Resume after shutdown always fetch last interrupted message again
- How to process a batch of received messages instead of a single piece?
- Can you output the message metadata to the logs?
- Only post messages after subscribing
- Watermill tests fail on windows
- The publish signature does not allow for a context.Context to be passed HOT 2
- Router closes publisher before message processing is done
- Removing usage of https://github.com/hashicorp/go-multierror
- [watermill-http] Custom HTTP response status HOT 2
- [watermill-kafka] is watermill-kafka still maintained? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watermill.