Creating channel connections
Once an application server has been specified, channel connections can be included in the environment file.
A channel is an abstract integration endpoint that uses adapters to represent the Network Transport Layer. It uses a Send-Receive interface in order to send and receive messages. Channels are configured and bound to physical communication addresses through connections. Before a connection can be made, its equivalent channel must exist.
Channels can be created in the Integration layer of NexJ Studio. The following channel connections are available:
File Connection
Allows you to send and receive files from a set of directories.
HTTP Connection
Allows you to send and receive messages through an HTTP channel as a client or server.
Kafka Connection
Allows you to send and receive messages through Apache Kafka.
Mail Connection
Allows you to send and receive email messages from a mail server.
Message Queue Connection
Allows you to send and receive messages between client applications using JMS.
Object Queue Connection
Allows you to send and receive messages between internal applications.
TCP Connection
Allows you to send and receive messages through a TCP channel as a client or server.
UDP Connection
Allows you to send and receive messages through a UDP channel as a client or server.
Channel connections can be added to an environment in any order. The number of connections that can be added is limited only by the number of available channels. Refer to the NexJ Framework Metadata Reference for detailed information on the elements and attributes of channel connections.
To create a new channel connection in NexJ Studio:
- Open the environment or connections file to which you want to add a channel connection.
The file opens in the editor window. - In the editor window, click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select the type of channel connection you would like to create and click Add.
The selected channel connection is added to the right-hand column. - Click OK to close the Select Channel Connections dialog.
The channel connection you specified is now listed in the Channel Connections area. When you select a channel connection from the list, its configuration options are displayed underneath.
For a list of required channel connections and sample configurations for NexJ CRM, see Channel connection settings.
Configuring channel connections
After creating a channel connection, configure the required properties based on the type of channel connection.
For a list of required channel connections and sample configurations for NexJ CRM, see Channel connection settings.
Configuring a file connection
A file connection can be configured to send, receive, or both send and receive files.
To use a file connection to receive files, you must at minimum specify the directory for incoming files. To use a file connection to send files, you must also specify the directory for outgoing files, and the temporary directory where outgoing files are prepared.
To configure a file connection in NexJ Studio:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, select the FileConnection that you want to configure.
Configuration options for the chosen connection are displayed underneath. - In the Incoming Directory field, enter a path that points to the directory to scan for incoming files.
- In the Outgoing Directory field, enter a path that points to the directory where outgoing files are placed.
- In the Temporary Directory field, enter a path that points to the directory used to prepare outgoing files.
- Click the Save button in the toolbar to save the changes to the connection.
Example
For example, to configure a connection for use with a typical AddressLookup channel:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select AddressLookup from the list, then click Add.
The selected connection is added to the right-hand column. - Click OK to close the Select Channel Connections dialog.
- In the Incoming Directory field, enter
\\App-Server.DOMAIN.EXT\AddressLookup\incoming
. - In the Temporary Directory field, enter
\\App-Server.DOMAIN.EXT\AddressLookup\temporary
. - In the Processed Directory field, enter
\\App-Server.DOMAIN.EXT\AddressLookup\processed
. - In the Outgoing Directory field, enter
\\App-Server.DOMAIN.EXT\AddressLookup\outgoing
. - In the Pattern field, enter
*.zip
as the file pattern to search for in a lookup. - In the Transaction Timeout field, enter 3600 as the number of milliseconds before the lookup times out.
- Click the Save button in the toolbar to save the changes to the environment.
These changes are reflected in the environment file XML as follows:
<Environment ...>
<ChannelConnections>
<FileConnection channel="AddressLookup" incomingDirectory="\\App-Server
.DOMAIN.EXT\AddressLookup\incoming" outgoingDirectory="\\App-Server.DOMAIN.EXT
\AddressLookup\outgoing" pattern="*.zip" processedDirectory="\\App-Server
.DOMAIN.EXT\AddressLookup\processed" temporaryDirectory="\\App-Server.DOMAIN.EXT
\AddressLookup\temporary" transactionTimeout="3600"/>
</ChannelConnections>
</Environment>
Configuring an HTTP connection
No specific configuration is required to use an HTTP connection.
For incoming HTTP messages, the connection receives its configuration from the channel. For outgoing HTTP messages, the connection configuration is sent to the channel through an HTTP raw message, which contains properties such as the URL, user name, and password.
Example
For example, to configure a connection for use with a typical ExchangeSender channel:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select ExchangeSender from the list, then click Add.
The selected connection is added to the right-hand column. - Click OK to close the Select Channel Connections dialog.
- In the URL field, enter Exchange-Host.DOMAIN.EXT.
- Click the Use HTTPS Communication and select false from the menu.
- Click the Authentication field and select credential from the menu.
- In the User field, enter
exchangeuser
. - In the Password field, enter
exchangepass
. - Ensure that
ExchangeSender
is selected and open the Properties view. - In the Value field of the
readTimeout
property, enter180000
as the number of milliseconds until outgoing HTTP requests time out. - Click the Save button in the toolbar to save the changes to the environment.
These changes are reflected in the environment file XML as follows:
<Environment ...>
<ChannelConnections>
<HTTPConnection authentication="credential" channel="ExchangeSender"
password="text:password" readTimeout="180000" secure="false" url="Exchange-
Host.DOMAIN.EXT" user="username"/>
</ChannelConnections>
</Environment>
Info
To configure email notifications, copy the following into your environment file:
<HTTPConnection authentication="none" channel="NotificationUnsubscribeChannel" password="text:"/>
Configuring a Kafka connection
A Kafka connection can be configured to enable the NexJ application to communicate with a Kafka server. You can specify whether the channel should send, receive, or both send and receive Kafka messages.
When configuring a Kafka channel connection, you must specify a value for the server
attribute. Based on your messaging requirements, you can define other attributes as needed.
To configure a Kafka connection in NexJ Studio:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select the KafkaConnection that you want to configure, and click Add.
The selected connection is added to the right-hand column. - Click OK to close the Select Channel Connections dialog.
In the servers field, enter a single host/port pair or a space-separated list of host/port pairs to use for establishing connection with the Kafka cluster.
The format for entering host/port pairs is <host>:<port>, for example,
localhost:8081
.Add additional attributes for the channel connection as needed. For more information, see Kafka channel connection settings.
If an attribute is configured both at the channel connection level and the channel level, the channel connection settings take precedence.
The channel connection is configured.
The changes are reflected in the environment file XML as follows:
<KafkaConnection secure="true" channel="KafkaChannel" authentication="basic" servers="localhost:9092" user="user" password="text:password" topic="kafkaTopic1" errorTopic="kafkaErrorTopic" maxPollRecords="5">
<SenderProperties>
<Property name="schema.registry.url" value="localhost:8081"/>
</SenderProperties>
</KafkaConnection>
Configuring a mail connection
A mail connection can be configured to send, receive, or both send and receive email messages.
To use a mail connection to receive mail, you must at minimum specify the email address that receives incoming messages, and the host name for the incoming mail server. To use a mail connection to send mail, you must also specify the default email address to which outgoing messages are sent, and the host name for the outgoing mail server. If the mail server requires authentication, you must specify an authentication password.
To configure a mail connection in NexJ Studio:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, select the MailConnection that you want to configure.
Configuration options for the chosen connection are displayed underneath. - In the Email Account field, enter the email address to which incoming mail is directed.
- If the mail server requires you to authenticate, enter the authentication password in the Password field.
- Under the Receiver Properties heading, enter the host name for the incoming mail server in the Host field.
- Under the Sender Properties heading, in the Sender E-mail field enter the default email address that outgoing mail is sent from.
- In the Host field, enter the host name for the outgoing mail server.
- (Optional) As of the NexJ CRM 9.7 release, the UI channel editor also contains fields for timeout properties, which you can use instead of manually entering these properties into the XML source code. You can specify values for the following timeout properties in milliseconds to avoid threads hanging when sending mail:
outConnectionTimeout:
This property provides the outgoing connection request timeout in milliseconds. The outConnectionTimeout has a default of 60000 milliseconds.outReadTimeout
This property provides the outgoing connection read timeout in milliseconds. The outReadTimeout has a default of 15000 milliseconds.- outWriteTimeout:
This property provides the outgoing connection write timeout in milliseconds. The outWriteTimeout has a default of 15000 milliseconds.
- Click the Save button in the toolbar to save the changes to the connection.
Example
For example, to configure a connection for use with a typical Mail channel:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select Mail from the list, then click Add.
The selected connection is added to the righthand column. - Click OK to close the Select Channel Connections dialog.
- In the Email Account field, enter
mailuser
. - In the Password field, enter
mailpass
. - Under the Receiver Properties heading, enter
INBOX
in the Folder field. - In the Protocol field, enter
pop3
as the protocol used for incoming mail. - In the Host field, enter
Exchange-Host.DOMAIN.EXT
. - Under the Sender Properties heading, in the Sender E-mail field enter
mailtest@nexjsystems.com
. - In the Protocol field, enter
smtp
as the protocol used for outgoing mail. - In the Host field, enter
Exchange-Host.DOMAIN.EXT
. - Click the Save button in the toolbar to save the changes to the environment.
These changes are reflected in the environment file XML as follows:
<Environment ...>
<ChannelConnections>
<MailConnection channel="Mail" from="mailtest@nexjsystems.com" inFolder=
"INBOX" inHost="Exchange-Host.DOMAIN.EXT" inProtocol="pop3"
outHost= "Exchange-Host.DOMAIN.EXT" outProtocol="smtp" password="text:password"
user="username"/>
</ChannelConnections>
</Environment>
Configuring a message queue connection
A message queue connection can be configured to send and receive messages between client applications.
To use a message queue connection, you must at minimum specify a user name and password.
To configure a message queue connection in NexJ Studio:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select the required message queue channel from the list, then click Add.
The selected connection is added to the right-hand column. - Click OK.
The Select Channel Connections dialog closes. - In the Channel Connections area, select the message queue connection that you want to configure.
Configuration options for the chosen connection are displayed underneath. - In the User field, enter the JMS queue user name.
- In the Password field, enter the JMS queue password.
- Fill in any other desired fields for the channel.
- Click the Save button in the toolbar to save the changes to the connection.
These changes are reflected in the environment file XML as follows:
<Environment ...>
<ChannelConnections>
<MessageQueueConnection channel="TestChannel" password="text:password"
user="username"/>
</ChannelConnections>
</Environment>
Configuring a TCP connection
A TCP connection can be configured to send, receive, or both send and receive TCP messages.
To use a TCP connection to receive messages, you must at minimum specify the number of the local port to which incoming messages are directed. The value for the local port property typically comes from the channel, but can optionally be set in the connection. To use a TCP connection to send messages, you must also specify the number of the port and the name of the host to which outgoing messages are directed.
To configure a TCP connection in NexJ Studio:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, select the TCPConnection that you want to configure.
Configuration options for the chosen connection are displayed underneath. - In the Host field, enter the name of the TCP host to which messages are sent.
- In the Port field, enter the number of the port on the TCP host to which messages are sent.
- In the Local Port field, enter the number of the port on the local machine to which incoming messages are directed.
- Click the Save button in the toolbar to save the changes to the connection.
Example
For example, to configure a connection for sending messages over an example TCP channel:
- Open the environment that you want to edit and click the Channel Connections tab.
In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens.In the left-hand column, select a channel from the list, then click Add. For example, select <ChannelNameForSender>.
The selected connection is added to the right-hand column.Info
If no TCP channels exist, you must create them from the Channels tab in the Integration layer.
- Click OK to close the Select Channel Connections dialog.
- In the Host field, enter
Host-Name.DOMAIN.EXT
. - In the Port field, enter
4321
as the remote port number. - In the Description field, enter
This defines a sender channel
. - Click the Sender tab.
- In the Sender Read Timeout field, enter
15000
as the number of milliseconds until outgoing TCP requests time out. - Click the Save button in the toolbar to save the changes to the environment.
These changes are reflected in the environment file XML as follows:
<Environment ...>
<ChannelConnections>
<TCPConnection channel="ChannelNameForSender" description="This defines
a sender channel" host="Host-Name.DOMAIN.EXT" port="4321" senderReadTimeout="15000"/>
</ChannelConnections>
</Environment>
Configuring a UDP connection
A UDP connection can be configured to send, receive, or both send and receive UDP messages.
To use a UDP connection to receive messages, you must at minimum specify the number of the local port to which incoming messages are directed. The value for the local port property typically comes from the channel, but can optionally be set in the connection. To use a UDP connection to send messages, you must also specify the number of the port and the name of the host to which outgoing messages are directed.
To configure a UDP connection in NexJ Studio:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, select the UDPConnection that you want to configure.
Configuration options for the chosen connection are displayed underneath. - In the Host field, enter the domain or IP address of the UDP host to which messages are sent.
- In the Port field, enter the number of the port on the UDP host to which messages are sent.
- In the Local Port field, enter the number of the port on the local machine to which incoming messages are directed.
- Click the Save button in the toolbar to save the changes to the connection.
Example
For example, to configure a connection for use with a typical ExchangeNotificationReceiver channel:
- Open the environment that you want to edit and click the Channel Connections tab.
- In the Channel Connections area, click the Select button .
The Select Channel Connections dialog opens. - In the left-hand column, select ExchangeNotificationReceiver from the list and click Add.
The selected connection is added to the right-hand column. - Click OK to close the Select Channel Connections dialog.
- In the Host field, enter
https://App-Server.DOMAIN.EXT
as the host domain. - In the Port field, enter
3001
as the remote port number. - In the Local Port field, enter
3001
as the local port number. - Click the Save button in the toolbar to save the changes to the environment.
These changes are reflected in the environment file XML as follows:
<Environment ...>
<ChannelConnections>
<UDPConnection channel="ExchangeNotificationReceiver"
host="https://App-Server.DOMAIN.EXT" localPort="3001" port="3001"/>
</ChannelConnections>
</Environment>