Manage Connections

Layer7 Live API Creator
exchanges 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 Creator
to invoke listeners. They hold the information that
Layer7 Live API Creator
requires to connect to that external system. You can reuse a connection in multiple listeners.
In this article:
Add a Connection Workflow
create a connection
create a connection
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 more information about MQTT, see the MQTT website.
  • 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 more information about Kafka, see the Apache Kafka documentation.
  • 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 more information about the RabbitMQ component, see Apache Camel documentation.
  • For JMSConsumer and JMSProducer connection types:
    • You know the values for the
      destinationType
      and
      destinationName
      parameters 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 know how to write JavaScript code that can instantiate a ConnectionFactory instance for the JMS provider.
    • You can connect to the JMS provider from where API Server is running.
  • For Db2iDataQueue connection types:
    • You have installed the JDBC driver for Db2 for i.
      For more information about how to install the JDBC driver for Db2 for i, see IBM Db2 for i Data Source.
    • 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.
    For more information about Db2 for i data queues, see the IBM Db2 for i website.
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:
  1. With your API open, in the Create section, click
    Listeners
    .
    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.
  2. Do one of the following steps:
    • If you have not created a connection yet, create a connection by clicking
      Create a Connection
      .
    • If you have at least one connection, complete the following steps:
      1. Click the
        Connections
        tab.
      2. Above the list of connections, click
        Add
        .
    The Add Connection window opens.
  3. Complete the following fields, and then click
    Add
    :
    Connection Name
    The name for your connection.
    Connection type
    Defines the protocol that you want
    Layer7 Live API Creator
    to follow to establish a link to an external system to exchange information.
    Options:
    MQTT, KafkaConsumer, KafkaProducer, RabbitMQConsumer, RabbitMQProducer, JMSConsumer, JMSProducer, and Db2iDataQueue
    The 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 (the
    Active
    checkbox is selected) and are defined as providers that can connect to outside systems to listen to messages or to publish to outside systems (the
    Can have connections
    checkbox 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.
  4. Define the connection parameters. Expand the details for each parameter that you want to define. Complete the following steps:
    1. Click the
      Parameters
      tab.
    2. Complete the values for the connection parameters that are listed. They are required. Verify the values by clicking
      Verify Parameters
      . To add a parameter, click
      Add Parameter
      .
      For MQTT connection types, clicking
      Verify Parameters
      also validates the connectivity to the MQTT broker.
      For more information:
    3. Click
      Save Parameters
      .
  5. Click the
    Details
    tab, select the
    Active
    checkbox, and then click
    Save
    .
Your connection is created and is active.
Mark a Connection as Active
Connections are either active or inactive.
Layer7 Live API Creator
starts 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
Active
checkbox.
Connections that are in the "Open" status are active.
Layer7 Live API Creator
successfully 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:
Icon
Connection Status
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 clicking
    Verify Parameters
    on the
    Parameters
    tab.
  • 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:
  1. In the Create section, click
    Listeners
    .
  2. Click the
    Connections
    tab.
  3. Change the connection.
  4. If the connection is in the "Closed" status and is active, click
    Reconnect
    .
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
Active
checkbox.
Layer7 Live API Creator
stops the listeners that are using the deleted connection. The
Connection
field 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: