Skip to content

Connections

Connections in SmartSpace are the means by which blocks communicate and exchange data during the execution of workflows. By understanding how connections work, you can efficiently design workflows that ensure proper data flow between blocks, enabling complex tasks to be performed.


What are Connections?

A connection in SmartSpace links the outputs of one block to the inputs of another, allowing data to be passed from one block to another as part of a workflow. Connections are the backbone of how workflows operate, enabling blocks to collaborate and share data efficiently.

Connections ensure that: - The output from a source block is available to the destination block’s input. - Blocks execute in the correct sequence based on the availability of required inputs.


Types of Connections

Direct Connections

Direct connections are the simplest form of connection, linking a specific output of one block to the input of another block. Once a block has finished processing, the data it produces is passed directly to the next block in the workflow.

For example, if Block A outputs a list of numbers and Block B calculates the sum of that list, the direct connection would link Block A’s output to Block B’s input.

Dynamic Connections

Dynamic connections are more flexible and are established based on runtime conditions. These connections allow for workflows to adapt based on input conditions, supporting scenarios where the number or type of inputs and outputs is not fixed.

For example, a block could dynamically decide to send outputs to different blocks based on the data it processes.


Connection Elements

Connections are made up of pins and channels, which define how data flows between blocks.

Pins

Pins are the endpoints of connections, representing the input and output points on a block. There are two main types of pins:

  • Input Pins: Receive data from another block.
  • Output Pins: Send data to another block.

Pins can be of several types:

  • Single Pins (PinType.SINGLE): Represent a single input or output value.
  • List Pins (PinType.LIST): Represent a collection of values (e.g., a list of integers).
  • Dictionary Pins (PinType.DICTIONARY): Represent key-value pairs for handling more complex input/output structures.

Channels

Channels represent a flow of data between two pins. Channels carry data between the output pin of one block and the input pin of another. Channels can transmit individual data items or continuous streams, depending on the type of connection.


Data Flow

The data flow in a SmartSpace workflow is the movement of data between blocks through connections. When a block completes its processing, it sends its outputs through output pins via the established connection to the next block’s input pins.

  • Synchronous Data Flow: Data flows from one block to the next in sequence, ensuring that blocks execute in a well-defined order.
  • Asynchronous Data Flow: Blocks may execute and send data independently of one another, especially when channels are used to stream data.

Establishing Connections

Connections between blocks are established by linking output pins of one block to input pins of another. In most cases, this process is straightforward and involves connecting matching input and output types (e.g., an integer output connects to an integer input).


Managing Multiple Connections

In complex workflows, blocks may have multiple inputs and outputs. Managing these connections properly ensures that data flows correctly between all the blocks in the workflow.

One-to-One:

In a one-to-one connection, a single output pin connects to a single input pin.

One-to-Many:

In a one-to-many connection, a single output pin connects to multiple input pins, distributing the same data to multiple blocks. This is useful when a single output needs to be consumed by several blocks.

Many-to-One:

In a many-to-one connection, multiple output pins connect to a single input pin. The input block will receive data from multiple sources, often using aggregation or merging logic to process the data.

Conclusion

Connections are the essential links between blocks in SmartSpace workflows, enabling data to flow from one block to another. By understanding how to establish and manage connections, how data flows through pins and channels, and how to handle complex workflows with multiple connections, you can design robust and scalable workflows that efficiently accomplish complex tasks. Error handling ensures that workflows remain stable even when unexpected issues arise.