# Predefined Actions

# Collect Messages

Attribute: queue

The queue process collects a group of incoming messages into a Redis array. Because special characters are common in such an incoming message, we base64 encode all the messages before storing them for the session.

Once the queue process started, a timer is initiated with the provided queue_timeout (seconds).

By default, the queue timeout equals to 5 seconds. You can override this behaivor and send your own queue_timeout under payload object. For example:

payload:
    queue_timeout: 10

The process will restart the timer for every incoming message until the timeout has passed from the last incoming message.

# queue is a simple operation
# that points to a predefined, internal application
type: Operation

# define the pointers to the
# internal app & app action
selector:
  workflow:
    - some_example_workflow
  app: core
  app_action: queue

# points to the next operations
next:
    selector:
        - type: operation
          data:
            workflow: some_example_workflow
            next: op_after_queue_messages

# unique operation identifier
key: my_queue_operation

# Update Session Info

Attribute: update_session

There are some cases where you need to update the session information directly as a complete step. The update_session operation does precisely that.

The example below takes advantage of the format_function capabilities to increment a counter.

TIP

Learn more about format_function

# update session is a simple operation
# that points to a predefined, internal application
type: Operation

# define the pointers to the
# internal app & app action
selector:
    app: core
    app_action: update_session

# modify input data
input:
    format_function:
            # choose the wanted format function
        -   operation: increment

            # set the detination for the writting
            # processes
            output: counter

            # define the format function value
            value:
                # taking the last counter value
                data: counter

                # pull the last counter from redis
                type: redis

                # defining the method
                # to pull data from redis
                rkey_type: hash_map

            # provide additional arguments for the increment
            # function
            args:
                # increment the value by one
                amount: 1