Comments (5)
Hello@flamedmg, could you post some example code? Can you also post logs output? Thanks!
from watermill.
Here is how i create a router:
func NewRouter(config RouterConfig, pub message.Publisher, logger logur.Logger) (*message.Router, error) {
h, err := message.NewRouter(
message.RouterConfig{
CloseTimeout: config.CloseTimeout,
},
watermilllog.New(logur.WithField(logger, "component", "watermill")),
)
if err != nil {
return nil, errors.WithMessage(err, "failed to create message router")
}
retryMiddleware := middleware.Retry{}
retryMiddleware.MaxRetries = 1
retryMiddleware.MaxInterval = time.Second * 60
h.AddMiddleware(
PoisonQueue(pub),
retryMiddleware.Middleware,
middleware.Recoverer,
middleware.CorrelationID,
)
return h, nil
}
If there is no such a queue in rabbitmq, there is no errors generated and poisoned messages are not delivered anywhere. I solved this by creating topology manually i.e. topology creates poisoned queue.
from watermill.
I am experiencing this issue as well.
from watermill.
Yeah, we had this issue as well. But to be honest I have no idea how to solve that properly. I see 2 options:
- Publisher should fail if it's publishing to queue that doesn't exist. But it may be tricky to "query" that. It can have performance implications as well.
- We can pass Subscriber to the middleware and call
SubscribeInitializer.SubscribeInitialize()
. It should create what is needed. Unfortunately, it's a bit weird that we need to provide subscriber for middleware.
I solved this by creating topology manually i.e. topology creates poison queue.
That sounds like the best idea, but it's easy to forget :(
@flamedmg @dwaynelavon any thoughts on that?
from watermill.
@flamedmg can I ask you how you implemented your own topology builder?
I'm trying to implement it, but it seems like the BuildTopology
is not being called; something like this (this is just me testing to see if the functions are called)
type myBuilder struct {
inner amqp.TopologyBuilder
}
func (m *myBuilder) BuildTopology(
channel *stread_amqp.Channel,
queueName string,
exchangeName string,
config amqp.Config,
logger watermill.LoggerAdapter,
) error {
fmt.Println("In BuildTopology")
panic("error")
}
func (m myBuilder) ExchangeDeclare(
channel *stread_amqp.Channel,
exchangeName string,
config amqp.Config,
) error {
fmt.Println("In ExchangeDeclare")
return m.inner.ExchangeDeclare(
channel,
exchangeName,
config,
)
}
func newMyBuilder() *myBuilder {
return &myBuilder{
inner: &amqp.DefaultTopologyBuilder{},
}
}
and Then I'm setting this in my config:
poisonRabbitCfg := amqp.NewDurablePubSubConfig(
cfg.RabbitURI,
func(topic string) string {
return topic
},
)
poisonRabbitCfg.TopologyBuilder = newMyBuilder()
I see ExchangeDeclare
being called, but the BuildTopology
is not being called (as you see I'm even panic
ing in there to see if it's called, but it's not
I also tried with amqp.NewDurableQueueConfig
(in my Rabbit config), but doesn't change anything
from watermill.
Related Issues (20)
- 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
- example: server-sent-events-htmx: How to swap the PUB SUB system ? HOT 5
- HelloGitHub Badge HOT 1
- Update documentation to reflect ExactlyOnceDelivery for PostgreSQL Pub/Sub
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.