Kafka Begin Session Service

The Kafka Begin Session Service establishes a session with a trading partner Kafka queue.

The following table provides an overview of the Kafka Begin Session Service:

System name Kafka Begin Session Service
Description This service is used to start a Kafka session with an external trading partner to exchange business documents.
Business usage Use this service to establish a session with a trading partner Kafka queue.
Usage example A business process is executed that translates a document that must be sent to a trading partner. After the translation, Sterling B2B Integrator uses the Kafka Begin Session Service to establish a session with the trading partner's Kafka queue. The Begin Session service works through a configuration of the Kafka Client adapter.
Preconfigured? No
Requires third-party files? No
Platform availability All Sterling B2B Integrator supported platforms.
Related services Related services:
  • Kafka Client Adapter
  • Kafka Consumer Service
  • Kafka Producer Service
  • Kafka End Session Service
Application requirements A Kafka server.
Initiates business processes? This service does not initiate business processes.
Invocation This service is invoked from a business process.
Returned status values N/A
Restrictions N/A
Persistence level Default
Testing considerations Test this service by running the KafkaClientDemoAllServices business process provided with Sterling B2B Integrator. This business process tests the Kafka Client adapter and all its related services.

Configuring the Kafka Begin Session Service

To configure the Kafka Begin Session service, you must specify settings for the following fields in the GPM:

Field Description
Name Name this service will have in Sterling B2B Integrator. Required.
Description Description of service. Required.
Select a Group Select one of the options:
  • None (default)– You do not want to include this configuration in a group at this time.
  • Create New Group – You can enter a name for a new group in this field, which will then be created along with this configuration.
  • Select Group – If you have already created one or more groups for this service type, they are displayed in the list. Select a group from the list.
Note: For more information about groups, see Managing Services and Adapters.
Config Name of the service configuration. Select KafkaBeginSession.
Action

Put - To push a document to the Kafka queue.

Get - To get a document from the Kafka queue.

GroupId A unique string that identifies the consumer group this consumer belongs to. Required.
BootStrapServers A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. This list should be in the form: host1:port1,host2:port2,....
SecurityAction Protocol used to communicate with brokers. Valid values are: PLAINTEXT, SSL, SASL_PLAINTEXT, SASL_SSL.
SASLMechanism SASL mechanism used for client connections. This may be any mechanism for which a security provider is available.
SASLJaasConfig JAAS login context parameters for SASL connections in the format used by JAAS configuration files. JAAS configuration file format is described here: JAAS Login Configuration File.
For example,
listener.name.sasl_ssl.scram-sha-256.sasl.jaas.config=com.example.ScramLoginModule required;
KafkaClientAdapter Select the Kafka Client Adapter for this service to use when beginning sessions with a Kafka server.
TrustStorePath The location of the trust store file.
TrustStorePassword The password for the trust store file.
KeyStorePath The location of the key store file. This is optional for client and can be used for two-way authentication for client.
KeyStorePassword The store password for the key store file.
ProducerConfig Sequence of additional producer configurations as needed for the producer. Refer to Producer Configs.
It is a list of key=value pairs separated by ;. For example,
buffer.memory=102400;compression.type=gzip
ConsumerConfig Sequence of additional consumer configurations as needed for the consumer. Refer to Consumer Configs.

It is a list of key=value pairs separated by ;.

KeySerializer Serializer class for key that implements the org.apache.kafka.common.serialization.Serializer interface.
ValueSerializer Serializer class for value that implements the org.apache.kafka.common.serialization.Serializer interface.
KeyDeserializer Deserializer class for key that implements the org.apache.kafka.common.serialization.Deserializer interface.
ValueDeserializer Deserializer class for value that implements the org.apache.kafka.common.serialization.Deserializer interface.
StorageType Type of storage required for the document to be stored at. It can be File System, Database or Object Store.
Timeout (Milliseconds) The maximum amount of time the client will wait for the response of a request (in milliseconds).
TLSVersion Select the TLS version from the drop-down menu. Valid values are:
  • TLSv1.2
  • TLSv1.3
Restriction: The TLS configuration parameter in Kafka only supports the input format TLSv1.2 and TLSv1.3. Setting the parameter as TLS1.2 and TLS1.3 is unsupported.
Note: The field TLSVersion is only available on Sterling B2B Integrator v6.2.0.2 and above.

Output from Service to Business Process

The following table contains the parameters passed from the Kafka Begin Session service to the business process:

Parameter Description
SessionID Specifies the identifier for the session established between the Kafka Client adapter and an Kafka server.
SessionBeginTime Identifies the time-stamp for start of the session.

Business Process Example

The following example business process illustrates using the Kafka Begin Session service for pushing a file to Kafka queue:

<process name="KafkaExample">
  <sequence>
    <operation name="Kafka Begin Session Service">
      <participant name=" KafkaBeginSessionService "/>
<output message="xout">        
  <assign to=" KafkaClientAdapter "> KafkaClientAdapter </assign>
        <assign to=" Action">put</assign>
        <assign to='BootStrapServers'>//CLUSTERIP1:PORT1,CLUSTERIP2:PORT2,...</assign>
	<assign to='KafkaClientAdapter'>//Mention the kafka adapter to invoke or ignore the entry</assign>
	<assign to='SecurityAction'>//Any Possible Action(PLAINTEXT/SASL_PLAINTEXT/SSL/SASL_SSL)</assign>
	<!-- Add below entries for SASL -->
	<assign to='SASLMechanism'>//SASLMechanism(SCRAM-SHA-512/PLAINLOGIN etc)</assign>
	<assign to='SASLJaasConfig'>//Path to jaas conf file</assign>
	<!-- End of SASL configuration -->
	<!-- Add below entries for SSL -->
	<assign to='TrustStorePath'>//Path to truststore</assign>
	<assign to='TrustStorePassword'>//Trusstore Password</assign>
	<!-- Add below entries for 2 way SSL-->
	<assign to='KeyStorePath'>//Path to Keystore</assign>
	<assign to='KeyStorePassword'>//Keystore Password</assign>
	<!-- End of entries for 2 way SSL-->
	<!-- End of entries for SSL configuration -->
	<assign to='ProducerConfig'>//Key value pairs separated by ;</assign>
	<assign to='KeySerializer'>//Specifiy the key serializer class</assign>
	<assign to='ValueSerializer'>//Specify the value serializer class</assign>
	<assign to='.' from='PrimaryDocument'/>      
</output>
      <input message="inmsg">
        <assign to="." from="*"/>      </input>
    </operation> 
[[Producer/Consumer session here]] 
[[End session here]] 
</process>
Note: To configure the SSL/SASL files for Certified Containers, Kafka client truststore, keystore and Jaas configuration files can be copied under volume mapped to /ibm/resources. It is the same volume that is used as persistent volume for appResourcesPVC section in values.yaml.
For example, while specifying the paths in the BPs:
/ibm/resources/kafka.client.truststore.jks