package
1.2.120
Repository: https://github.com/searking/golang.git
Documentation: pkg.go.dev

# README

dispatch

A powerful read and handle workflow dispatcher for golang.


Install

With a correctly configured Go toolchain:

go get -u github.com/searKing/dispatch

Examples

Let's start registering a couple of URL paths and handlers:

func main() {
    var conn chan int
    workflow := dispatch.NewDispatcher(
    	dispatch.ReaderFunc(func() (interface{}, error) {
    		return ReadMessage(conn)
    	}), 
    	dispatch.HandlerFunc(func(msg interface{}) error {
    		m := msg.(*int)
    		return HandleMessage(m)
    	}))
    workflow.Start()
}

Here we can set the workflow joinable.

    workflow := dispatch.NewDispatcher(nil, nil).Joinable()
    go workflow.Start()
    workflow.Join()

Here we can cancel the workflow.

    workflow := dispatch.NewDispatcher(nil, nil).Joinable()
    go workflow.Start()
	workflow.Context().Done()
	workflow.Join()

And this is all you need to know about the basic usage. More advanced options are explained below.

SEE example


License

MIT licensed. See the LICENSE file for details.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Dispatch is a middleman between the Reader and Processor.

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author