nio http egress connector

NIO HTTP Egress Connector

Version: 17.07

Supported Since: 17.01

What is NIO HTTP Egress Connector?

The NIO HTTP Egress Connector is used to send HTTP messages from ESB to a remote server destination which consist of a host name, a port and a service path. NIO HTTP Egress Connector supports HTTP RFC 2616.

This connector cannot be used with query parameters; any included in the URL (service path) will be ignored. If you need to use query parameters, consider switching to the dynamic URL egress connector (see below).

NIO Http Dynamic URL Egress Connector

NIO Http Dynamic URL Egress Connector is a NIO Http connector which can be used to send messages to a dynamically assigned URLs to messages within the integration flow.

"NIO Http Dynamic URL Egress Connector" has the same functionality as the NIO HTTP Egress Connector with one exception. It does not expect Hostname, Port and the Service Path as connector parameters. Instead it uses the Destination URL that is set to a message which comes in to the connector to extract those parameters.

NIO HTTP Egress connector needs ram-mounted directory a RAM Disk. 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 NIO HTTP Egress 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 egress connector 4

Out Ports

On Exception

The message will be emitted from this out port if the processing element failed to send the message ot the external system

Response Processor

The response message received will be directed to emitted from port. You can use this port to connect any precessing element or connector that is supposed to process/consume the response.

Side Ports

Connector Operation

This port is used to connect operational elements to the Egress Connector. By-default, user does not have to connect any operational element and the default connector operation will be used.

Parameters

* marked fields are mandatory

Parameter

Category

Description

Destination Address Type *

Basic

Select the type of the destination address. URL type will deliver the message into the specified absolute URL which is constructed using Destination Host, Destination port and Service Path. PREFIX type will deliver the message to the constructed URL from the prefix constructed using Destination Host, Destination port and Service Path, suffixed by the original requests path.

Suppose you want to forward all the requests coming to /front/.* service path of a NIO HTTP ingress connector to /back/.* endpoint.

Then at the HTTP ingress connector, specify /front/.* as the Service path. At HTTP egress connector specify PREFIX as the Destination Address Type and specify back for Service Path.

Now when a message is received by the ingress connector for /front/path/anotherpath/, then that will be forwarded to the /back/path/anotherpath/ resource path at the back end.

Destination Host *

Basic

The hostname of the endpoint to which this connector is supposed to send messages.

Destination Port

Basic

The port in the endpoint given by Destination Host to which this connector will be sending messages. The default value is 80

Service Path

Basic

The service path to which this connector will be sending the messages. If not specified, context path for the request will be used as the default value

Egress Timeout

Advanced

Timeout value in milliseconds for the egress message. After this time amount has been elapsed, the message flow will end exceptionally without waiting for the response from the external system.

Zero copy enabled

Transport Configuration

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

Connection debug

Transport Configuration

Whether to enable connection debug or not. Connection debug gives you a log if something went wrong in connection level

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.

Replace User-Agent

Transport Configuration

If selected user agent header will be replaced by ESB’s server name

Unzip Response Entities

Transport Configuration

Select for unzip compressed responses. Where compressed responses are not required for processing, it may be better to leave them intact for extreme direct proxying cases

Proxy Host

Sender Configuration

The proxy server hostname, if there is a proxy server to go through

Proxy port

Sender Configuration

The proxy server port, if there is a proxy server to go through. (Should be a valid integer between 0 and 65535)

Proxy Bypass list

Sender Configuration

The proxy bypass list, Requests sent to these hosts will not be subjected to proxing. This list can be specified as a custom Spring bean in project.xpml

Keep-Alive timeout

Sender Configuration

The default keep alive time for re-usable outgoing connections in connection pool, in milli-seconds. Defaults to 30 seconds.

Keep-Alive safety threshold

Sender Configuration

The safety threshold to leave at the end of the keep-alive duration, where a connection is not re-used in the connection pool. (In milli-seconds). Defaults to 5 seconds.

Max connections per route

Sender Configuration

The maximum connections per route (i.e. scheme http/s, host and port pair). Defaults to 2048

Max connections

Sender Configuration

The total maximum connections to be opened at any time. Defaults to 4096

Continue on runtime exceptions

Sender 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

Continue on checked exceptions

Sender 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

Tuning parameters

Sender Configuration

HTTP level tuning parameters as a map.

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 Properties

key Description

x.internal.last_absolute_url

The value of the actual destination absolute URL

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

x.http.response_status_code

Holds the HTTP response status code of received response

x.http.response_time

Holds the time between last read time and last write time (response time) in milli-seconds

ERROR codes

Code

Description

101500

The error code indicating an IOException while sending

101501

The error code indicating an IOException while receiving

101503

The error code indicating a failed connection attempt

101504

The error code indicating a connection [socket] timeout waiting for a response from the remote party

101505

The error code indicating a connection close by the remote party while receiving

101506

The error code indicating a HTTP protocol violation

101507

The error code indicating a connection attempt request being cancelled

101508

Error code indicating a connection attempt timeout occurred

Note : Can be configured using property "http.connection.timeout" on the Http/s NIO Egress connector

101512

The error code indicating a connection [socket] timeout submitting the request to a remote party

101513

The error code indicating a connection close by the remote party while sending

Sending Query Parameters

NIO HTTP Egress Connector

The query parameters should be provided within the Service Path parameter value.

e.g.: Service Path = /getUser?id=1&name=mike

NIO Http Dynamic URL Egress Connector

The query parameters should be added using the Add Query Parameter processing element.

Sample Use Case

Prerequisite

To send a Http request to an remote server you will need to start this remote server on a specific port(or you can use existing HTTP server as well). In case you don’t have such server with you already, AdroitLogic Ultra Studio has a handy tool which can start multiple HTTP servers on selected ports in no time. You can find this tool by clicking on the Jetty Server tool windows which is located at the right side tool window palette of Intellij IDEA. Once you open the tool it’s just a matter of seconds to start a echo-server instance, just click on the "Start Jetty Server" button on top-right.

Open Jetty Server
Figure 1: Open Jetty Server
Sending a HTTP message

In this sample let’s build upon the NIO HTTP Ingress Connector sample and add a NIO HTTP Egress Connector to send receiving request to Jetty server which runs on port 9000. The overall flow is as shown below.

nio http egress connector 3

Set the Destination Address type to URL, Destination Host to localhost, Service Path to /service/EchoService and Destination Port is 9000 in the HTTP Egress Connector configuration as below

nio http egress connector 2

Now create a run configuration and run the project. Upon 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

pen 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.

In this topic
In this topic
Contact Us