Layer7 Live API Creatorexchanges information with external systems by following the protocol that is defined in a connection. Connections are a set of properties that represent connections to external systems that cause
Layer7 Live API Creatorto invoke listeners. They hold the information that
Layer7 Live API Creatorrequires to connect to that external system. You can reuse a connection in multiple listeners.
In this article:
Add a Connection Workflow
Verify the Prerequisites
Before you can create a connection, verify that you have completed the following prerequisite steps:
- For MQTT connection types:
- You know the MQTT broker host name and port.
- You can connect to the MQTT broker from where API Server is running.
- For KafkaConsumer and KafkaProducer connection types:
- You know the Kafka server host name and port.
- You can connect to the Kafka server from where API Server is running.
- For RabbitMQConsumer and RabbitMQProducer connection types:
- You know the RabbitMQ server host name, port, exchange name, exchange type (topic/direct) and auto delete flag for the exchange.
- You can connect to the RabbitMQ server from where API Server is running.
- For JMSConsumer and JMSProducer connection types:
- You know the values for thedestinationTypeanddestinationNameparameters for the queue or topic.For more information about these parameters, see JMS Listeners.
- You know the JMS provider to which you are connected.
- You can connect to the JMS provider from where API Server is running.
- For Db2iDataQueue connection types:
- You know the hostname, port, exchange name, exchange type, and the data queue residing on the IBM Db2 for i database to which you are connecting.
- You can connect to the data queue residing on Db2 for i from where API Server is running.
Create a Connection
When you create a connection, you also configure and tailor it by defining parameters for the connection. Connection parameters are sets of configuration properties that are assigned to a connection object to customize its behavior.
Follow these steps:
- With your API open, in the Create section, clickListeners.If you have not created any connections yet, the Welcome to Listeners and Connections page displays. If you have created at least one connection, the Listeners page displays.
- Do one of the following steps:
- If you have not created a connection yet, create a connection by clickingCreate a Connection.
- If you have at least one connection, complete the following steps:
- Click theConnectionstab.
- Above the list of connections, clickAdd.
- Complete the following fields, and then clickAdd:Connection NameThe name for your connection.Connection typeDefines the protocol that you wantLayer7 Live API Creatorto follow to establish a link to an external system to exchange information.Options:MQTT, KafkaConsumer, KafkaProducer, RabbitMQConsumer, RabbitMQProducer, JMSConsumer, JMSProducer, and Db2iDataQueueThe list of options that display include the default listener providers and the providers that the system administrator (sa) user added. The listener providers listed are active (theActivecheckbox is selected) and are defined as providers that can connect to outside systems to listen to messages or to publish to outside systems (theCan have connectionscheckbox is selected).For more information about listener providers, including these checkboxes, see Manage Listener Providers.The connection is added to the list of connections. The Details tab is selected by default.
- Define the connection parameters. Expand the details for each parameter that you want to define. Complete the following steps:
- Click theParameterstab.
- Complete the values for the connection parameters that are listed. They are required. Verify the values by clickingVerify Parameters. To add a parameter, clickAdd Parameter.For MQTT connection types, clickingVerify Parametersalso validates the connectivity to the MQTT broker.For more information:
- About the parameters that you can define based on your connection type, see the context help.
- ClickSave Parameters.
- Click theDetailstab, select theActivecheckbox, and then clickSave.
Your connection is created and is active.
Mark a Connection as Active
Connections are either active or inactive.
Layer7 Live API Creatorstarts only active connections in active APIs. Listeners that use active connections listen for the arrival of messages and execute the code. You can mark a connection as active or inactive by selecting or clearing the
Connections that are in the "Open" status are active.
Layer7 Live API Creatorsuccessfully established the link to the destination to which you are connecting. Open connections are available for publishing and receiving messages. Connections that are in the "Closed" status have issues or the connection is inactive.
The "Open" and "Closed" statuses are indicated with an icon in the top right corner for a connection.
The status depends on the connection type. For example, the status for RabbitMQ and JMS connection types is the status of the underlying Camel Context and not the validity of the connection parameters. For MQTT connection types, the status depends on the validity of the connection parameters.
You can also see the status of a connection by viewing the icon that displays to the left of the connection name in the list of connections:
The connection is in the "Open" status and is active.
The connection is in the "Closed" status and is active.
The connection is in the "Closed" status and is inactive.
If you import an API that includes active connections and listeners into API Creator using API Creator, you must enable the API after you import the API. Enabling the API automatically marks the connections active and automatically restarts the listener.
For more information about how to import an exported API that includes active connections and listeners using API Creator, see Import and Export APIs.
The status is based on the following factors:
- The validity of the parameters.You can verify the values for your parameters by clickingVerify Parameterson theParameterstab.
- Network connectivity.
- Internal exceptions.
Change the Details and Parameters for a Connection
You can change active and inactive connections. If the connection is active and you change its details or parameters, you must apply those changes to the connection.
Follow these steps:
- In the Create section, clickListeners.
- Click theConnectionstab.
- Change the connection.
- If the connection is in the "Closed" status and is active, clickReconnect.
Your changes are applied to the connection and your connection is restarted.
Delete a Connection
Prererequisite:Before you delete a connection, stop the connection by clearing the
Layer7 Live API Creatorstops the listeners that are using the deleted connection. The
Connectionfield on the Details tab for the listener displays as blank. You can update those listeners that are using the deleted connection to use another connection.
For more information about how to define the connection that a listener uses to connect to: