2019-11-25 18:31:43 +02:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2021-10-12 13:55:53 +02:00
|
|
|
"go-micro.dev/v4/broker"
|
|
|
|
"go-micro.dev/v4/transport"
|
2019-11-25 18:31:43 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// event is a broker event we handle on the server transport
|
|
|
|
type event struct {
|
2020-03-06 23:25:16 +02:00
|
|
|
err error
|
2019-11-25 18:31:43 +02:00
|
|
|
message *broker.Message
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *event) Ack() error {
|
|
|
|
// there is no ack support
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *event) Message() *broker.Message {
|
|
|
|
return e.message
|
|
|
|
}
|
|
|
|
|
2020-03-06 23:25:16 +02:00
|
|
|
func (e *event) Error() error {
|
|
|
|
return e.err
|
|
|
|
}
|
|
|
|
|
2019-11-25 18:31:43 +02:00
|
|
|
func (e *event) Topic() string {
|
|
|
|
return e.message.Header["Micro-Topic"]
|
|
|
|
}
|
|
|
|
|
|
|
|
func newEvent(msg transport.Message) *event {
|
|
|
|
return &event{
|
|
|
|
message: &broker.Message{
|
|
|
|
Header: msg.Header,
|
|
|
|
Body: msg.Body,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|