Flow proxy - Flow Sender example

Contents


1. Goal

This example demonstrates the use of the Flow Sender producer together with the Flow Proxy consumer. The Flow Sender hands a message to another flow and does not wait for it.

In this example, the main flow picks up an input file and hands it to a secondary flow with a Flow Sender. The secondary flow drops the file in an output folder.

You split work over two flows like this when more than one flow needs the same next step. Each sending flow points at the same receiving flow, so you build and maintain that step once.


2. Prerequisites

Item Value

ConnectAgent version

>= 5.2

Operating system

Linux minimal kernel 3.1.x
Red Hat 8 / 9 / 10
Rocky 8 / Rocky 9 / Rocky 10
Windows Server 2016 or higher

Required applications

ConnectAgent installed

Required permissions

Local administrator access with write permission on the target directory

Required directories

Input, backup and output directories


3. Architecture

Flow-Sender-Flow-Proxy-flow


4. Resources, Scripts, Beans and Global Properties

This example does not require any Resource, Script, Bean or Global Property.


5. Components

Both flows are in one interface, order-handoff.

Flow 1 (pickup-orders)

Step Component Purpose

1

File Pickup

Pick up the input file

2

Flow Sender

Hand the message to Flow 2

Flow 2 (write-orders)

Step Component Purpose

1

Flow Proxy

Expose the Flow as an endpoint that can be invoked by Flow 1

2

File Drop

Drop the file in the output folder


6. Component Configuration

Flow 1

File Pickup

Property Value Explanation

Pickup Directory

C:/orders/in

Path to the input directory

Backup Directory

C:/orders/backup

The File Pickup puts a copy of each file it picks up here

Flow Sender

Property Value Explanation

Output flow

order-handoff.write-orders

The Flow to hand the message to (the interface and the name of Flow 2)

Before you can select Flow 2 as the output flow, you must configure a Flow Proxy consumer in Flow 2.

The Flow Sender properties in the pickup-orders flow

Flow 2

Flow Proxy

Property Value Explanation

MessagePart Out

msgprt0

Specifies the MessagePart that receives the output message. By default, the value is msgprt0.

The Flow Proxy properties in the write-orders flow

File Drop

Property Value Explanation

Output directory

C:/orders/out

Path to the output directory

File name Header

file_name

Specifies the header that will be used to specify the output file name. File_name header contains the original name by default, so the output file will retain the name.


7. Example Input

Any file can be used for this example. You can drag and drop an existing file, or create a new empty plain text file if preferred.


8. Processing

  1. File Pickup consumer is constantly checking for files in the input directory

  2. File is dropped on the Input directory

  3. File Pickup picks up the file and puts a copy in the backup directory

  4. Flow Sender hands the message (file and contents) to the second flow. Flow 1 does not wait for Flow 2.

  5. Flow 2 receives the message

  6. Flow 2 drops the file on the output folder


9. Expected Output

  • The input file has disappeared from the input directory.

  • The file now appears in the output directory with the original file name.

  • The backup directory holds a copy with a timestamp in front of the name, such as 20261015-143012123_order.xml.


10. Error Scenarios

Situation Expected Result

Directory Missing

Flow will automatically create the output directory.

Flow Proxy consumer of Flow 2 is stopped

The message is not delivered. The agent logs a warning and the message is lost.

An answer from Flow 2 is needed

The Flow Sender does not wait for an answer. Use a Flow Gateway service instead, and end Flow 2 with a Message Reply producer.


11. Testing

To verify and reproduce this example, please follow the instructions below:

  1. Create the input, backup and output directories

  2. Start the ConnectAgent

  3. Configure the Flows with the properties described above and create a Bundle

  4. Deploy the Interface into the Agent

  5. Drop a file in the input directory

  6. Verify the backup and output directories.


12. Variations

Here are some ideas to extend this example:

  • Add a second sending flow with its own File Pickup that also hands its files to Flow 2. Both flows now share one File Drop.

  • To send to a flow in another interface, set Inter-Interface to true on the Flow Sender. The Output flow list then shows the flows of the other interfaces too.


13. Related Documentation