FixTask Documentation

Back to summary

import "task/channel";

Dispatcher class

Dispatcher handles receiving of messages from multiple channels using callbacks.

Functions

static function register(channel: Channel, func, data)
static function register_sync(channel: Channel, func, data)
Registers receiving of messages from given channel using the provided callback. The callback receives the data as a first argument and the message as a second. In the synchronous variant the return value of the callback is passed back unless handle_async function is used.
static function unregister(channel: Channel)
Unregisters receiving of messages from given channel.
static function run_later(delay: Integer, func, data)
Runs given function after the delay in milliseconds.
static function enter_loop(): Dynamic
Starts the dispatcher loop. It can be stopped by using the leave_loop function.
static function leave_loop()
static function leave_loop(value: Dynamic)
Stops the dispatcher loop with optional return value.
static function dispatch()
static function dispatch(timeout: Integer): Boolean
Runs a single iteration of the dispatcher loop to provide a way to use custom loop. The variant with timeout returns true when it processed a message.
static function handle_async(): Dynamic
Returns a value that can be used to stop sending of the return value in the synchronous callback, turning it into a conditional asynchronous variant.
static function integrate_async()
Enables integration with FixIO async event loop if available. Currently this integration is permanent and you will leak resources if used in a non-permanent task.