messenger

package
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2018 Tharanga Nilupul Thennakoon

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.

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.

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.

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.

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

View Source
const Exchange = "quebic-faas-eventbus"

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEvent

type BaseEvent struct {
	// contains filtered or unexported fields
}

BaseEvent type

func (*BaseEvent) GetCreated

func (baseEvent *BaseEvent) GetCreated() string

GetCreated get created

func (*BaseEvent) GetError

func (baseEvent *BaseEvent) GetError() string

GetError get requestHeaders

func (*BaseEvent) GetEventID

func (baseEvent *BaseEvent) GetEventID() string

GetEventID get eventID

func (*BaseEvent) GetHeaderData

func (baseEvent *BaseEvent) GetHeaderData(key string) string

GetHeaderData get requestHeaders

func (*BaseEvent) GetPayload

func (baseEvent *BaseEvent) GetPayload() []byte

GetPayload get payload []byte

func (*BaseEvent) GetPayloadAsObject

func (baseEvent *BaseEvent) GetPayloadAsObject() interface{}

GetPayloadAsObject get payloadObject as a perticular object

func (*BaseEvent) GetPayloadAsString

func (baseEvent *BaseEvent) GetPayloadAsString() string

GetPayloadAsString get payload string

func (*BaseEvent) GetRequestID

func (baseEvent *BaseEvent) GetRequestID() string

GetRequestID get requestID

func (*BaseEvent) GetStatuscode

func (baseEvent *BaseEvent) GetStatuscode() int

GetStatuscode get requestHeaders

func (*BaseEvent) ParsePayloadAsObject

func (baseEvent *BaseEvent) ParsePayloadAsObject(payloadObject interface{}) error

ParsePayloadAsObject parse to object you provided

type Messenger

type Messenger struct {
	AppID          string
	EventBusConfig config.EventBusConfig
	// contains filtered or unexported fields
}

Messenger interface

func (*Messenger) Close

func (messenger *Messenger) Close()

Close close connection

func (*Messenger) Init

func (messenger *Messenger) Init() error

Init create connection

func (*Messenger) Publish

func (messenger *Messenger) Publish(
	eventID string,
	payload interface{},
	requestHeaders map[string]string,
	successHandler func(message BaseEvent, statuscode int),
	errHandler func(err string, statuscode int),
	requestTimeout time.Duration) (string, error)

Publish publish

func (*Messenger) PublishBlocking

func (messenger *Messenger) PublishBlocking(
	eventID string,
	payload interface{},
	requestHeaders map[string]string,
	successHandler func(message BaseEvent, statuscode int),
	errHandler func(err string, statuscode int),
	requestTimeout time.Duration) (string, error)

PublishBlocking publish and wait caller thread until responce came

func (*Messenger) ReleseQueue

func (messenger *Messenger) ReleseQueue(routingKey string)

ReleseQueue release queue

func (*Messenger) ReplyError

func (messenger *Messenger) ReplyError(requestBaseEvent BaseEvent, errMessage string, statuscode int) error

ReplyError reply error response

func (*Messenger) ReplySuccess

func (messenger *Messenger) ReplySuccess(requestBaseEvent BaseEvent, replyPayload interface{}, statuscode int) error

ReplySuccess reply success response

func (*Messenger) Subscribe

func (messenger *Messenger) Subscribe(eventID string, requestHandler func(baseEvent BaseEvent), consumerName string) error

Subscribe subscribe

func (*Messenger) WaitInit

func (messenger *Messenger) WaitInit(wait time.Duration) error

WaitInit create connection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL