Documentation ¶
Overview ¶
Copyright 2012-2019 The NATS Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type BridgeHeader
- type BridgeMessage
- func (msg *BridgeMessage) DeleteProperty(name string) interface{}
- func (msg *BridgeMessage) Encode() ([]byte, error)
- func (msg *BridgeMessage) GetBoolProperty(name string) (bool, bool)
- func (msg *BridgeMessage) GetBytesProperty(name string) ([]byte, bool)
- func (msg *BridgeMessage) GetFloat32Property(name string) (float32, bool)
- func (msg *BridgeMessage) GetFloat64Property(name string) (float64, bool)
- func (msg *BridgeMessage) GetInt16Property(name string) (int16, bool)
- func (msg *BridgeMessage) GetInt32Property(name string) (int32, bool)
- func (msg *BridgeMessage) GetInt64Property(name string) (int64, bool)
- func (msg *BridgeMessage) GetInt8Property(name string) (int8, bool)
- func (msg *BridgeMessage) GetStringProperty(name string) (string, bool)
- func (msg *BridgeMessage) GetTypedProperty(name string) (interface{}, bool)
- func (msg *BridgeMessage) HasProperty(name string) bool
- func (msg *BridgeMessage) SetProperty(name string, value interface{}) error
- type Properties
- type Property
Constants ¶
const ( // PropertyTypeString type value for a string property PropertyTypeString = 0 // PropertyTypeInt8 type value for an int8 property PropertyTypeInt8 = 1 // PropertyTypeInt16 type value for an int16 property PropertyTypeInt16 = 2 // PropertyTypeInt32 type value for an int32 property PropertyTypeInt32 = 3 // PropertyTypeInt64 type value for an int64 property PropertyTypeInt64 = 4 // PropertyTypeFloat32 type value for a float32 property PropertyTypeFloat32 = 5 // PropertyTypeFloat64 type value for a float64 property PropertyTypeFloat64 = 6 // PropertyTypeBool type value for a bool property PropertyTypeBool = 7 // PropertyTypeBytes type value for a []byte property PropertyTypeBytes = 8 // PropertyTypeNull type value for a null property PropertyTypeNull = 9 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeHeader ¶
type BridgeHeader struct { Version int32 `codec:"version,omitempty"` Report int32 `codec:"report,omitempty"` MsgType int32 `codec:"type,omitempty"` Expiry int32 `codec:"exp,omitempty"` Feedback int32 `codec:"feed,omitempty"` Encoding int32 `codec:"enc,omitempty"` CodedCharSetID int32 `codec:"charset,omitempty"` Format string `codec:"format,omitempty"` Priority int32 `codec:"priority,omitempty"` Persistence int32 `codec:"persist,omitempty"` MsgID []byte `codec:"msg_id,omitempty"` CorrelID []byte `codec:"corr_id,omitempty"` BackoutCount int32 `codec:"backout,omitempty"` ReplyToQ string `codec:"rep_q,omitempty"` ReplyToQMgr string `codec:"rep_qmgr,omitempty"` UserIdentifier string `codec:"user_id,omitempty"` AccountingToken []byte `codec:"acct_token,omitempty"` ApplIdentityData string `codec:"appl_id,omitempty"` PutApplType int32 `codec:"appl_type,omitempty"` PutApplName string `codec:"appl_name,omitempty"` PutDate string `codec:"date,omitempty"` PutTime string `codec:"time,omitempty"` ApplOriginData string `codec:"appl_orig_data,omitempty"` GroupID []byte `codec:"grp_id,omitempty"` MsgSeqNumber int32 `codec:"seq,omitempty"` Offset int32 `codec:"offset,omitempty"` MsgFlags int32 `codec:"flags,omitempty"` OriginalLength int32 `codec:"orig_length,omitempty"` ReplyToChannel string `codec:"reply_to_channel,omitempty"` }
BridgeHeader maps to an MQMD struct in the MQ messages
type BridgeMessage ¶
type BridgeMessage struct { Body []byte `codec:"body,omitempty"` Header BridgeHeader `codec:"header,omitempty"` Properties Properties `codec:"props,omitempty"` }
BridgeMessage is the NATS-side wrapper for the mq message
func DecodeBridgeMessage ¶
func DecodeBridgeMessage(data []byte) (*BridgeMessage, error)
DecodeBridgeMessage decodes the bytes and returns the decoded version use NewBridgeMessage to create a message with an empty header
func NewBridgeMessage ¶
func NewBridgeMessage(body []byte) *BridgeMessage
NewBridgeMessage creates an empty message with the provided body, the header is empty
func (*BridgeMessage) DeleteProperty ¶
func (msg *BridgeMessage) DeleteProperty(name string) interface{}
DeleteProperty removes a property from the map, and returns it If the item isn't present, nil is returned
func (*BridgeMessage) Encode ¶
func (msg *BridgeMessage) Encode() ([]byte, error)
Encode a bridge message to bytes
func (*BridgeMessage) GetBoolProperty ¶
func (msg *BridgeMessage) GetBoolProperty(name string) (bool, bool)
GetBoolProperty returns the property as a boolean and true, or false and false if the property is not a bool, or doesn't exist.
func (*BridgeMessage) GetBytesProperty ¶
func (msg *BridgeMessage) GetBytesProperty(name string) ([]byte, bool)
GetBytesProperty returns the property as a []byte and true, or nil and false if the property is not a []byte, or doesn't exist.
func (*BridgeMessage) GetFloat32Property ¶
func (msg *BridgeMessage) GetFloat32Property(name string) (float32, bool)
GetFloat32Property returns the property as a sized float and true, or 0 and false if the property is not the correct size float, or doesn't exist.
func (*BridgeMessage) GetFloat64Property ¶
func (msg *BridgeMessage) GetFloat64Property(name string) (float64, bool)
GetFloat64Property returns the property as a sized float and true, or 0 and false if the property is not the correct size float, or doesn't exist.
func (*BridgeMessage) GetInt16Property ¶
func (msg *BridgeMessage) GetInt16Property(name string) (int16, bool)
GetInt16Property returns the property as a sized int and true, or 0 and false if the property is not the correct size int, or doesn't exist.
func (*BridgeMessage) GetInt32Property ¶
func (msg *BridgeMessage) GetInt32Property(name string) (int32, bool)
GetInt32Property returns the property as a sized int and true, or 0 and false if the property is not the correct size int, or doesn't exist.
func (*BridgeMessage) GetInt64Property ¶
func (msg *BridgeMessage) GetInt64Property(name string) (int64, bool)
GetInt64Property returns the property as a sized int and true, or 0 and false if the property is not the correct size int, or doesn't exist.
func (*BridgeMessage) GetInt8Property ¶
func (msg *BridgeMessage) GetInt8Property(name string) (int8, bool)
GetInt8Property returns the property as a sized int and true, or 0 and false if the property is not the correct size int, or doesn't exist.
func (*BridgeMessage) GetStringProperty ¶
func (msg *BridgeMessage) GetStringProperty(name string) (string, bool)
GetStringProperty returns the property as a string and true, or "" and false if the property is not a string, or doesn't exist.
func (*BridgeMessage) GetTypedProperty ¶
func (msg *BridgeMessage) GetTypedProperty(name string) (interface{}, bool)
GetTypedProperty takes a property
func (*BridgeMessage) HasProperty ¶
func (msg *BridgeMessage) HasProperty(name string) bool
HasProperty returns true if the property exists
func (*BridgeMessage) SetProperty ¶
func (msg *BridgeMessage) SetProperty(name string, value interface{}) error
SetProperty adds a property to the map with the correct type, using reflection to get the type out of the value. An error is returned if the type isn't supported All unsigned ints (except uint8==byte) are converted to int64, as is int. A single byte is cast to an int8 to match the MQ series library
type Properties ¶
Properties is a wrapper for a map of named properties