2019-11-25 16:31:43 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2020-01-30 14:39:00 +03:00
|
|
|
"github.com/micro/go-micro/v2/broker"
|
|
|
|
"github.com/micro/go-micro/v2/transport"
|
2019-11-25 16:31:43 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// event is a broker event we handle on the server transport
|
|
|
|
type event struct {
|
|
|
|
message *broker.Message
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *event) Ack() error {
|
|
|
|
// there is no ack support
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *event) Message() *broker.Message {
|
|
|
|
return e.message
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|