nio http egress connector

HTTP NIO Egress Connector

Version: 17.01

Supported Since: 17.01

What is HTTP NIO Egress Connector?

The HTTP NIO 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. HTTP NIO Egress Connector supports HTTP RFC 2616.

Sample Use Case

Prerequisite

In order to use the HTTP NIO Ingress 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 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.

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 we’ll take the NIO HTTP Ingress Connector sample in to the next level and add a NIO HTTP Egress Connector to send receiving request to Jetty server which runs on port 9000.

Search for "NIO HTTP Sender" connector and drag and drop in the editor. Set the Destination Address type to URL and edit the configurations so that Destination Host is localhost, Service Path is /service/EchoService and Destination Port is 9000 . Hit the save button when you done. Refer to figure 2

Egress Config
Figure 2: Egress Config

Next complete the flow by connecting processing elements, refer to figure 3.

Complete flow
Figure 3: Complete flow

Now create a run configuration if one not already configured and then run the project. Take a look at 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

It’s the time to send a HTTP Request and test our flow. 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.

In Ports

Input

The message to be sent to an external endpoint comes through this port.

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.

Out Ports

On Exception

The message will be sent to this outport if the processing element failed to transform the payload due to some reason

Response Processor

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

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

Service Path*

Basic

The service path to which this connector will be sending the messages to.

Zero copy enabled

Transport

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

Connection debug

Advanced

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

Connection debug headers

Transport

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

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

Unzip Response Entities

Transport

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

Egress Timeout

Advanced

Timeout value in milliseconds for the egress message

Proxy Host

Sender

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

Proxy port

Sender

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

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

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

Keep-Alive safety threshold

Sender

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

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

Max connections

Sender

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

Continue on runtime exceptions

Sender

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

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

HTTP level tuning parameters as a map. This map can be specified as a custom Spring bean in project.xpml

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 absolute URL sent to

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

In this topic
In this topic
Contact Us