Designing a subflow created as a .subflow file
When designing a subflow, you need to choose whether to
use a subflow created as a .subflow file or as
a .msgflow file. In IBM® Integration Bus, you
create your subflows as .subflow files for new
integration solutions.
You can add subflows into your message flows if either of the following
statements is true:
- The subflow that you want to add to a message flow is defined
in a library.
Applications and services can reference libraries.
Note: A
library is a logical grouping of related code, data, or both that
typically contains reusable subflows, and other type of resources.
- The subflow that you want to add to a message flow is defined
in the same Integration project, application, or integration service
as the message flow.
During the development phase, in the
IBM Integration Toolkit,
you can define a subflow once, and then reuse it in more than one
message flow.
- If you use a subflow across multiple applications or integration
services, you should define the subflow within a library. This library
can then be referenced by any application or integration service that
needs access to the resources it contains.
- If you use a subflow multiple times within one application or
within one service, then you can define the subflow as part of the
application, the integration service, or the library.
Note: When the IBM Integration Bus run
time encounters a subflow within a message flow, it creates a copy
of all the message flow nodes that define that subflow. If the subflow
is used more than once, it creates a copy of all the message flow
nodes that define the subflow every time it occurs. This increases
resource usage, which can affect your overall message flow performance.
Types of subflows supported
In IBM Integration Bus, you
can create a subflow as a .subflow file or as
a .msgflow file. However, if you develop new
integration solutions, you must create subflows of type .subflow.
Subflow content
You define subflow content
in the same way as you define message flow content, by adding, configuring,
and connecting message flow nodes.
A subflow can have one or
more input nodes, and zero, one, or more output nodes.
- If you want to use a subflow as the first node in your message
flow, you need to add at least one Input node, such as the MQInput
node, and one generic Output node.
- If you want to use a subflow in the middle of a message flow,
you need to add at least one generic Input node. You only need to
add a generic Output node if you want to connect additional nodes
in the message flow after you add the subflow.
- If you want to use a subflow as the last node in a message flow,
you need to add at least one generic Input node, and at least one
Output node, such as the MQOutput node.
Subflows created as .subflow files
are grouped in the folder named Subflows within
your application, integration service, or Integration project. The
following figure illustrates the location in a project where you can
create subflows or see all the subflows defined under that project:
When you create a subflow created as a .subflow file,
the Message Flow editor automatically creates a generic input node
and a generic output node.
If
you want to use a subflow created as a .subflow file
as the first node in a message flow, you must add an Input node such
as an MQInput node instead of the generic input node.
You cannot use the following nodes
in subflows created as
.subflow files:
- Nodes representing subflows that are created as .msgflow files.
- WebSphere® Message
Broker Version 7.0 Mapping nodes.
- User-defined nodes created from subflows that are created as .msgflow files.
- MQOptimizedFlow nodes.
Design considerations
When you design a
subflow, you should consider the following recommendations:
- Reuse logic by creating a subflow created as a .subflow file.
- Define subflows of type .subflow in libraries.
Create references to a library from your applications or integration
services to be able to reuse the common logic.
- Limit the number of nested subflows.
- Group logic that is defined in consecutive compute nodes into
one single compute node. This will improve performance, since the
number of nodes loaded at runtime will be reduced.
- Add a version to the subflow. For more information, see Versioning a subflow.
- Do not nest subflows of different types, that is, do not add a
subflow created as a .msgflow file into a subflow
created as a .subflow file or vice versa.
- To reuse a subflow created as a .msgflow file
into a subflow created as a .subflow file, convert
the subflow created as a .msgflow file into a .subflow file.
To
convert a subflow, right-click the subflow name, and select Convert
to subflow. For more information, see Converting subflows.