You define a subflow to provide
a common sequence of actions to be used by several message flows,
applications, or services. Puede incluir subflujos en los flujos de mensajes de la misma manera que se incluyen nodos incorporados o definidos por el usuario.
También puede conectar subflujos a otros
nodos de la misma manera.
A subflow provides the following benefits:
- Reutilización y tiempo de desarrollo reducido.
- Coherencia y posibilidad de mantenimiento de los flujos de mensajes (considere un
subflujo
como una macro de programación o como código en línea que se escribe una vez pero se
utiliza en muchos sitios).
- Flexibilidad para personalizar un subflujo para un contexto específico (por ejemplo, actualizando la cola de salida o información de origen de datos).
Consulte estos ejemplos de utilización de subflujo:
- Puede definir un subflujo que proporcione una secuencia común de acciones
que se aplique a varios flujos de mensajes si se produce un error.
Por ejemplo, puede tener una rutina común de errores que escriba el mensaje en una base
de datos a través del nodo Database,
y lo coloque en una cola para que lo procese una rutina de recuperación de errores. El
uso de esta rutina en varios flujos de mensajes o en varios sitios dentro de un flujo de
mensajes, proporciona un uso eficaz y coherente de los recursos y evita tener que
reinventar esas rutinas cada vez que se produce un error.
- Es posible que desee llevar a cabo un cálculo común de los mensajes que pasan por varios flujos de mensajes distintos; por ejemplo, quizá desee acceder a las tasas de cambio de divisas de una base de datos y aplicarlas para calcular precios en varias monedas distintas. Puede incluir el subflujo de cálculo de moneda en cada flujo
de mensajes que sea adecuado.
Types of subflows
You define a subflow once,
and use it in more than one message flow, application, service, and Message Broker
project. You
define subflow content in the same way as you define message flow
content, by adding, configuring, and connecting message flow nodes.
Nota: At runtime, each instance of a subflow creates a copy of all
the message flow nodes that define that subflow. This affects resource
usage, which can affect your overall message flow performance.
You can create a subflow as a
.subflow file
or as a
.msgflow file. Elija qué tipo de subflujo utilizar basándose en la siguiente información:
- A subflow that is defined in a .subflow file
can be deployed in any of the following ways:
- Separately from any of the message flows that use this subflow.
The subflow and the message flows that include this subflow must be
deployed in the same execution group in a broker. The subflow can
be deployed directly into an execution group in a broker, or as part
of a library. If you update this type of subflow and redeploy it,
all message flows that use this subflow, and are not part of an application
or service, are automatically updated. You do not need to redeploy
these message flows.
- As part of an application or service.
- No puede utilizar los nodos siguientes en este tipo de subflujo:
- Nodos que representan subflujos que se definen en archivos .msgflow
- Nodos definidos por el usuario creados a partir de subflujos que se definen en archivos .msgflow
- Nodos MQOptimizedFlow
- Si crea
un archivo BAR que contiene código ESQL y un subflujo que se define en un archivo
.subflow, no puede incluir el código ESQL directamente en
archivos de flujo de mensajes compilado.
- A subflow that is defined in a .msgflow file,
is embedded inside any parent message flows that use it when the message
flow is placed in a bar file. This type of subflow therefore can only
be deployed to a broker with the message flow in which it is used.
- Si actualiza este tipo de subflujo, debe volver a
desplegar todos los flujos de mensajes que utilizan el subflujo para que los cambios se
utilicen.
- Este tipo de subflujo puede empaquetarse como un nodo definido por el usuario.
Conditions that apply when you convert a subflow between .msgflow and .subflow and viceversa
You can convert a subflow created as a
.msgflow file to a
.subflow file.
- If the .msgflow file contains subflows that
are defined as .msgflow files, these subflows must
also be converted to .subflow files.
- Si el archivo .msgflow se utiliza como un subflujo,
el flujo padre deben actualizarse para que haga referencia al nuevo archivo
.subflow.
You can convert a subflow created as a
.subflow file to a
.msgflow file.
- You cannot use the name of a file that already exists in that
application, library, or Message Broker project where you create your
subflow as a .msgflow file. You must include .msgflow at the end of your subflow file name.
Conditions that apply when you want to add a subflow
into a message flow
You can add subflows into a message
flow if either of the following statements is true:
- The subflow that you want to add in a message flow is defined
in a library, and you have specified the dependency of the current
message flow project on that other project. Applications and services
can reference libraries.
Nota: 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 in a message flow is defined
in the same Message Broker project, application project or service
project as the message flow.
Conditions that apply when you want to add a subflow
into a subflow
You can add subflows into a subflow in any
of the following cases:
- You can add subflows that are defined in .subflow files into subflows that are defined in .subflow files and .msgflow files.
- You can add subflows that are defined in .msgflow files into subflows that are defined only in .msgflow files.
Conditions that apply when you deploy a subflow
You can deploy subflows in any of the following ways:
- Deploy a subflow as an independent resource defined within a Message
Broker project.
- Deploy a subflow as part of an application project.
- Deploy a subflow as part of a service operation.
- Deploy a subflow as part of a library.
You deploy a subflow to an execution group by sending
a broker archive (BAR) file to an execution group in a broker, which
unpacks and stores the contents ready for when your message flows
are started.
The following conditions apply when you deploy
a subflow as part of an integration solution:
- If you deploy a message flow that contains a subflow that is defined
in a .subflow file, the subflow is automatically
included in the BAR file.
- If you deploy a subflow that is contained in an application, you
must deploy the application to an execution group, which results in
a complete deployment of the application.
- If you deploy a subflow that is contained in a service, you must
deploy the service to an execution group, which results in a complete
deployment of the service.
- If you deploy a subflow that is contained in a library, you can
deploy the library to an execution group directly, outside of an application
or a service. Then the subflow included in the library can be referenced
by other message flows and subflows that are deployed directly to
the same execution group as the library.
- A subflow that is created as a .msgflow file
in a Message Broker project can only be deployed as a separate resource
if it contains at least one Input node.
Version control
Use the Passthrough node to enable
version control of a subflow at runtime.
Al incluir un nodo de
Passthrough, puede añadir una etiqueta al flujo o subflujo de mensajes. Mediante la combinación de esta
etiqueta con la sustitución de palabras clave de su sistema de control de
versiones, puede identificar qué versión de un subflujo está incluida en
un flujo de mensajes desplegado.
Puede
utilizar esta etiqueta para fines personales. If you have included
the correct version keywords in the label, you can see the value of
the label in a any of the following ways:
- By using the mqsireadbar command to read the properties stored in the broker archive
(BAR) file.
- In the WebSphere Message Broker Toolkit, on the properties
of a deployed message flow as last deployed to a particular broker.
- In the runtime environment, if you enable user trace for that
message flow.
For subflows created as a
.subflow file, you must consider the following behaviour when deploying a
new version of a subflow:
- If the subflow is deployed separately from any of the message
flows that use this subflow and you deploy a new version of the subflow,
then all the message flows are updated automatically.
- If the subflow is deployed as part of an application or service,
then you need to update your applications and services to include
the new subflow version, and redeploy them.
For subflows created as a
.msgflow file, you must consider the following behaviour when deploying a
new version of a subflow:
- You need to update your applications, services, and independent
resources that use the subflow to include the new subflow version,
and redeploy them.
Ejemplos
El uso de subflujos se muestra en los siguientes ejemplos:
El manejador de errores utiliza un subflujo para atrapar información sobre errores y
almacenar la información en una base de datos. La Respuesta de solicitud coordinada utiliza un subflujo para encapsular el almacenamiento de los valores
ReplyToQ y
ReplyToQMgr en un mensaje
WebSphere MQ de forma que la lógica de proceso pueda reutilizarse en otros flujos de mensajes y para permitir la sustitución de implementaciones alternativas.
Puede
ver información sobre los ejemplos sólo cuando utilice el centro de información que está
integrado en WebSphere Message Broker Toolkit o el centro de información en línea. Puede
ejecutar ejemplos sólo cuando utilice el centro de información que está integrado en WebSphere Message Broker Toolkit.