nio http ingress connector

HTTP NIO Ingress Connector

Version: 17.07

Supported Since: 17.01

What is HTTP NIO Ingress Connector?

The HTTP NIO Ingress Connector is used to receive HTTP messages from a remote client by listening to a specific port on a specific service path and injects those messages in to the ESB engine. HTTP NIO Ingress Connector supports HTTP RFC 2616.

NIO HTTP Ingress connector needs ram-mounted directory a RAM Disk to operate. Make sure the directory /tmp/ram is already created with the appropriate permissions and it is mounted on the ram.
In order to use the HTTP NIO Ingress Connector, you must first select the HTTP NIO Connector dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the HTTP NIO Connector dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list, select the HTTP NIO Connector dependency.
nio http ingress connector 7

Out Ports

Processor

The message received to the NIO HTTP Ingress Connector from a HTTP Client will be emitted from this out port

On Exception

The message will be emitted from this out port if the Ingress Connector fails to process the message payload

Input

The message sent to this out port will be sent as the response to the HTTP Client which initiated the request

Parameters

* marked fields are mandatory

Http Port *

Basic

The port value which the Ingress Connector should be listened. Must be an Integer value between 0 to 65535

Service Path *

Basic

The path which the Ingress Connector can be reached.

Response Timeout

Advanced

Ingres Connector will be timeout when the value specified here exceeds without getting a response to the input in port

IO Thread Count

Transport Configuration

Number of IO Threads to be used in-order to accept HTTP requests

Local Bind Address

Transport Configuration

The local address to bind when the Ingress Connector is started. If not specified, binds on all interfaces by default

Connection Debugging Enabled

Transport Configuration

Whether to enable connection debug or not. Connection debug gives you a log if something went wrong in connection level. By default this will be enabled.

Connection Debug Headers

Transport Configuration

A comma separated list of HTTP headers to be dumped on a connection failure, when connection debugging is enabled. Specify as 'all' to dump all headers or as 'none' to prevent dumping of headers.

Allowed HTTP Methods

Transport Configuration

The HTTP methods allowed for requests processed via this Ingress Connector (multiple methods can be selected)

Zero Copy Enabled

Transport Configuration

Whether to enable zero copying or not. Read more about Zero-Copy

Turn Off Response Compression

Transport Configuration

Whether to turn off the use of Gzip compression even if the request contains an Accept-Encoding header

Compressing Trigger Size

Transport Configuration

The minimum size of a response (in bytes) to trigger compression, if supported by the client. Default value is 2K bytes

Continue on Runtime Exceptions

Transport Configuration

Whether the engine should continue execution on the occurrence of a runtime exception. If set to false, engine will shutdown and restart on such a situation. By default this is enabled.

Continue on checked exceptions

Transport Configuration

Whether the engine should continue execution on the occurrence of a checked exception. If set to false, engine will shutdown and restart on such a situation.

Stop New Connections At Soft Limit

Transport Configuration

The connection limit on which the Ingress Connector should pause accepting new connections. Default value is 4096. In reality this limit maybe surpassed.

Resume New Connections At Soft Limit

Transport Configuration

The connection limit on which the Ingress Connector should resume accepting new connections. Default value is 3072.

Maximum Payload Size

Transport Configuration

The maximum payload size to accept (in bytes). Default value is 1MB.

Tuning parameters

Transport Configuration

Specify a map of HTTP tuning parameters.

http.socket.timeout

TCP level socket timeout

http.connection.timeout

Time limit to establish a TCP level connection

http.tcp.nodelay

Use of nagle algorithm ? - default true

http.jvm.interest-ops-queued

Should NIO interest ops be queued? false for Sun/Oracle JDKs, true for IBM JDK

http.socket.buffer-size

Socket buffer size - default 8K

Message Context Properties

key Description

x.http.conn_remote_addr

Remote IP address which initiated the HTTP request

x.http.conn_remote_port

Remote Port which initiated the HTTP request

x.http.conn_local_addr

Local IP address which the request received

x.http.conn_local_port

Local Port which the request received

x.http.service_url

The service url which the request received

Message Properties

key Description

x.http.query_string

String representation of URL query parameters

Note: the query string MUST be treated as read-only and any changes to this string will not be effective for the message being sent out from the ESB.

x.http.query_param_map_wdups

Holds a Map<String, List<String>> of URL query parameters including duplicates. This Map can be changed during the flow, and the resulting values re-used if the message is forwarded

x.http.method

HTTP method of received HTTP request

x.http.message_size

The size of the received message over HTTP.

Note: This is only available for requests and responses received - and not for messages about to be sent out

x.http.header_size

The size of the received message header over HTTP.

Note: This is only available for requests and responses received - and not for messages about to be sent out

x.http.entity_size

The size of the received message payload over HTTP.

NOTE: This is only available for requests and responses received - and not for messages about to be sent out

ultra.transport.address_url_postfix

The message property which could hold a postfix for a "prefix" type address. The final address used to send a message is computed as: <prefix address> + <postfix>

ERROR codes

Code

Description

101000

The error code indicating an error during sending a response back to the client

101001

The error code indicating an IOException error in receiving a message from a client

101002

The error code indicating an HTTP protocol error in receiving a message from a client

101003

The error code indicating a connection [socket] timeout reading the request from the client

101005

The error code indicating a connection close [socket] reading the request from client

101006

The error code indicating that a response cannot be submitted as the connection to client is already closed

Sample Use Case

Prerequisite

To test the Http ingress connector, you need a HTTP client tool. With AdroitLogic Ultra Studio we have a handy HTTP/S client tool which you can use to send HTTP or HTTPS requests. You can find this tool by clicking on Ultra Studio Toolbox IDEA Tool Window bar button and then clicking on the plus(+) sign on the top left of the opened Tool Window and then selecting HTTP/S Client (Figure1). After clicking on that you’ll get a HTTP Client interface to send HTTP messages as shown in the Figure 2.

Open HTTP/S client
Figure 1: Open HTTP/S client
HTTP/S client interface
Figure 2: HTTP/S client interface
Receiving a HTTP message

In this sample let’s create a integration flow which is able to receive a HTTP message from a remote client, add a custom HTTP header to the message and then send it back to the original client as a HTTP response. The Integration flow is as shown below

nio http ingress connector 5

For the HTTP Ingress Connector configuration specify the Http port as 8280 and Service Path as /service/echo-service as shown below

NIO HTTP Lister Config
Figure 3: NIO HTTP Lister Config

Next add Add New Transport Header processing element and configure it as shown below

Add Header config
Figure 4: Add Header config

Now create a run configuration and then run the project. By examining the logs printed out on the IDEA Run Tool window, you will be able to see that the UltraESB server is started and listening on the port 8280

Next open the HTTP/S client Tool Window and set a sample request payload in the text box located in the left. After setting the URL text field as well you can send the message out. When the response received, inspect the Response text box and you’ll find the MyHeader HTTP header (Figure 6)