Documentation
¶
Overview ¶
*
- =========================================================================== *
- define all interface in this file
- =========================================================================== *
*
- =========================================================================== *
- define all interface in this file
- =========================================================================== *
Index ¶
Constants ¶
View Source
const ( PREFIX = "servicebus" STATUS_DONE int8 = 5 STATUS_RUNNING int8 = 1 STATUS_CANNEL int8 = 3 REQ_TIMEOUT = 3 * time.Second // ---- value is for interface "FutureReturnResult" NONE int8 = 0 ALL_COMPLETE int8 = 1 ANY_ERRORS int8 = 2 ALL_ERRORS int8 = 3 )
*
- --------------------------------- *
- constant region
- --------------------------------- *
Variables ¶
View Source
var ( Err000001 = uerrors.NewCodeErrorWithPrefix(PREFIX, "000000", "Error Test Example") // ---- alias error name ---- Err000002 = uerrors.NewCodeErrorWithPrefix(PREFIX, "000002", "Result map from response is not null.") Err000003 = uerrors.NewCodeErrorWithPrefix(PREFIX, "000003", "Object inputted is not a pointer. ") )
Functions ¶
func FunctypeInObject ¶
func FunctypeInObject(object interface{}) string
*
- --------------------------------- *
- function region
- --------------------------------- *
Types ¶
type EventMapping ¶
type EventMapping struct { EventName string // binding reference instance Ref interface{} /** * define event name */ FunctionName string }
*
type EventbusContext ¶
type EventbusContext interface { GetRequestData() interface{} /** * Get the result inteface */ GetResult() Result /** * support service event */ GetServiceEvent() ServiceEvent }
--- create bus context ----
type EventsDelegate ¶
type EventsDelegate struct {
// contains filtered or unexported fields
}
*
- define event delegate
func NewEventsDelegate ¶
func NewEventsDelegate() *EventsDelegate
func (*EventsDelegate) AddEvent ¶
func (this *EventsDelegate) AddEvent(event string, handler interface{}, functionName string)
func (*EventsDelegate) AllEventMethods ¶
func (this *EventsDelegate) AllEventMethods() map[string]reflect.Value
*
- get all method by define ---
func (*EventsDelegate) AllEventsPredefined ¶
func (this *EventsDelegate) AllEventsPredefined() map[string]*EventMapping
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 Result ¶
type Result interface { /** * complement object */ Complete(refobj interface{}) /** * 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(serviceId string, fn func(ServiceEventHandler)) 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 }
type ServiceEventHandler ¶
type ServiceEventHandler interface { /** * define request body object */ ConvertRequestBody(func() (reqData interface{})) /** * define process handler */ Process(func(bc EventbusContext) uerrors.CodeError) }
*
- contruct service event handler
- @deplecated this object is not to use
type ServiceManager ¶
type ServiceManager interface { ServiceEvent /** * boot listen service */ ListenServices() error }
*
- contruct service manager
Click to show internal directories.
Click to hide internal directories.