diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2019-02-08 08:38:56 +0100 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2019-02-08 10:04:56 +0100 |
commit | df05a70f90a1486a86a4156b1b0d68c94f2098b4 (patch) | |
tree | 45577756efc2ec766430ed17daa9ddcf9c5709b2 /core/channel.go | |
parent | fa21c9d726ebb807895a8571af9a16dab5cd8d6e (diff) |
Add support for using multiple generated versions
- added CheckCompatibility for checking if given messages are compatible
- generating Messages global for easier usage of compatibility check
- added ReconnectInterval and MaxReconnectAttempts for reconnecting
- added Failed state that is sent after exceeding max reconnect attempts
Change-Id: I1062ba453f22657c1a2a31aa64cb103ef1223b0f
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'core/channel.go')
-rw-r--r-- | core/channel.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/channel.go b/core/channel.go index 5b69eab..bf27b73 100644 --- a/core/channel.go +++ b/core/channel.go @@ -142,10 +142,14 @@ func (ch *Channel) SendMultiRequest(msg api.Message) api.MultiRequestCtx { return &multiRequestCtx{ch: ch, seqNum: seqNum} } -func getMsgFactory(msg api.Message) func() api.Message { - return func() api.Message { - return reflect.New(reflect.TypeOf(msg).Elem()).Interface().(api.Message) +func (ch *Channel) CheckCompatiblity(msgs ...api.Message) error { + for _, msg := range msgs { + _, err := ch.msgIdentifier.GetMessageID(msg) + if err != nil { + return err + } } + return nil } func (ch *Channel) SubscribeNotification(notifChan chan api.Message, event api.Message) (api.SubscriptionCtx, error) { |