restart replication if RabbitMQ connection closed

https://github.com/google/go-cloud/issues/2958
This commit is contained in:
Konstantin Lebedev 2021-02-10 15:29:05 +05:00
parent 770393a48c
commit 0cfed8c3cb
3 changed files with 4 additions and 0 deletions

View file

@ -113,6 +113,10 @@ func (k *GoCDKPubSubInput) Initialize(configuration util.Configuration, prefix s
func (k *GoCDKPubSubInput) ReceiveMessage() (key string, message *filer_pb.EventNotification, onSuccessFn func(), onFailureFn func(), err error) { func (k *GoCDKPubSubInput) ReceiveMessage() (key string, message *filer_pb.EventNotification, onSuccessFn func(), onFailureFn func(), err error) {
msg, err := k.sub.Receive(context.Background()) msg, err := k.sub.Receive(context.Background())
if err != nil { if err != nil {
var conn *amqp.Connection
if k.sub.As(&conn) && conn.IsClosed() {
glog.Fatalln(err)
}
return return
} }
onFailureFn = func() { onFailureFn = func() {