api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

*

  • =========================================================================== *
  • define all interface in this file
  • =========================================================================== *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback interface {
}

type ClientApi

type ClientApi interface {

	// On add event by name for message
	On(eventName string, fn func(ReqMsgContext)) error

	// FireByQueue
	FireByQueue(eventName string, msgBody []byte, callback ...Callback) error

	// FireByPublish
	FireByPublish(eventName string, msgBody []byte, callback ...Callback) error
}

ClientApi Api Event is define full message

type EventbusContext

type EventbusContext interface {
	GetRequestData() interface{}

	/**
	 * Get the result inteface
	 */
	GetResult() Result

	/**
	 * support service event
	 */
	GetServiceEvent() ServiceEvent
}

--- create bus context ----

type FailureCallback

type FailureCallback interface {
	Callback

	Fail(err uerrors.CodeError)
}

type Future

type Future interface {

	/**
	 * wait the event complete
	 */
	Await() uerrors.CodeError

	/**
	 * get the result object after await
	 */
	GetResult() (FutureReturnResult, uerrors.CodeError)
}

*

  • return the service event futrue

type FutureReturnResult

type FutureReturnResult interface {

	/**
	 * define,  ALL_COMPLETE ,  ANY_ERRORS , ALL_ERRORS
	 */
	State() int8

	/**
	 *  return all error from service event running
	 */
	Errors(procName string) uerrors.CodeError

	/**
	 * rturn all return Results
	 */
	ReturnResults(procName string, inReturn interface{}) uerrors.CodeError

	/**
	 * get the first error directly
	 */
	Error() uerrors.CodeError

	/**
	 * get the first result directly
	 */
	ReturnResult(inReturn interface{}) uerrors.CodeError
}

*

  • This interface will map the futurn result handle

type ReqMsgContext

type ReqMsgContext interface {

	// GetMsgRawBody get request message from body
	GetMsgRawBody() []byte

	// get the response result context
	GetResResult() Result
}

*

  • contruct service event handler
  • @deplecated this object is not to use

type Result

type Result interface {
	/**
	 *	complement object
	 */
	Complete(refobj []byte)

	/**
	 *  add the result
	 */
	Fail(err uerrors.CodeError)
}

*

  • define base result

type RootTypeDecoder

type RootTypeDecoder interface {
	ProvideRootRef() interface{}
}

*

  • define root type decoder

type ServiceEvent

type ServiceEvent interface {

	/**
	 * call one service handle
	 */
	On(eventName string, fn func(ReqMsgContext)) error

	/**
	 * fire service in synchronous mode
	 */
	FireSyncService(serviceId string, runtimeArgs interface{}, timeout time.Duration, fn func(FutureReturnResult, uerrors.CodeError))

	/**
	 * fire service in asynchronous mode
	 */
	FireService(serviceId string, runtimeArgs interface{}) error
}

ServiceEvent ServiceEvent is define full message

type SuccessCallback

type SuccessCallback interface {
	Callback

	Succeed(content []byte)
}

Jump to

Keyboard shortcuts

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