Reference: Client Configuration#

This chapter deals with the available configuration options of nJAMS Client for Mule4. The examples shown refer to the use of the nJAMS configuration file. But this chapter is also useful for learning about the different configuration options while using the Inline configuration.

The configuration file njams.properties resides in <your-project>/src/main/resources/njams/. Use an editor of your choice and edit njams.properties according to your needs.

Note

Any change in this configuration file requires a re-start of the MuleSoft Runtime Engine instances.

General#

njams.mule.enabled:

Enables/disables nJAMS Client for Mule4:

true enables nJAMS Client for Mule4 (default).

false disables nJAMS Client for Mule4 .

Note

njams.disabled is deprecated. If you are updating nJAMS Client for Mule4 from an older version, please use njams.mule.enabled.

njams.mule.replay.enabled:

Enables/disables Reply functionality of nJAMS Client for Mule4.

true enables Replay.

false disables Replay.

njams.sdk.logAllErrors:

Controls, when nJAMS Client for Mule4 should send error events.

true automatically creates error events for catched and uncatched exceptions.

false automatically creates error events only for uncatched exceptions (default).

Communication#

The following properties control the communication between nJAMS Client for Mule4 and nJAMS Server.

Commucation over HTTP/S:

Sample configuration for HTTP or HTTPS:

########## HTTP Connection ##########
njams.sdk.communication=http
njams.sdk.communication.http.base.url=http://localhost:8080/njams/
njams.sdk.communication.http.dataprovider.suffix=data

### Authentication ###
njams.sdk.communication.http.user=njams
njams.sdk.communication.http.password=njams

### Proxy ###
njams.sdk.communication.http.proxy.host=localhost
njams.sdk.communication.http.proxy.port=80
njams.sdk.communication.http.proxy.user=njams
njams.sdk.communication.http.proxy.password=njams

### SSL/HTTPS ###
njams.sdk.communication.http.ssl.certificate.file=/opt/njams/cert
njams.sdk.communication.http.ssl.keyStore=/opt/njams/keystore
njams.sdk.communication.http.ssl.keyStoreType=jks
njams.sdk.communication.http.ssl.keyStorePassword=123
njams.sdk.communication.http.ssl.trustStore=/opt/njams/truststore
njams.sdk.communication.http.ssl.trustStoreType=jks
njams.sdk.communication.http.ssl.trustStorePassword=123

### Advanced ###
njams.sdk.communication.http.ssl.unsafe.disableHostnameVerification=false
njams.sdk.communication.http.ssl.unsafe.trustAllCertificates=false
Communication over JMS:

njams.sdk.communication.jms.connectionFactory:

Sets the connection factory, for example “ConnectionFactory”.

njams.sdk.communication.jms.username:

Use a valid JMS user that has the required privileges to send and receive messages on the destinations defined in njams.sdk.communication.jms.destination.

njams.sdk.communication.jms.password:

The JMS user’s password.

njams.sdk.communication.jms.destination:

The JMS destination name prefix. The prefix will be extended with .event for event messages send by nJAMS Client for Mule4 and .commands for messages send from the server to the nJAMS Client for Mule4. Default is njams.

njams.sdk.communication.jms.destination.commands:

Name of the JMS destination that is used to send commands from nJAMS Server to nJAMS Client for Mule4. This setting is optional and only used, if you want to use a dedicated topic commands.

njams.sdk.communication.jms.java.naming.factory.initial:

Sets the JNDI context factory.

njams.sdk.communication.jms.java.naming.security.principal:

Set JNDI user name.

njams.sdk.communication.jms.java.naming.security.credentials:

Set JNDI user’s password.

njams.sdk.communication.jms.java.naming.provider.url:

The JNDI server connection url. Fault-tolerant or load-balanced URLs are supported.

Sample configuration of a JMS Data Provider using ActiveMQ:

########## SDK configuration ##########
### Communication settings ###
njams.sdk.communication=JMS

### JMS settings ###
njams.sdk.communication.jms.connectionFactory=QueueConnectionFactory
njams.sdk.communication.jms.username=admin
njams.sdk.communication.jms.password=admin
njams.sdk.communication.jms.destination=dynamicQueues/njams

### JNDI settings ###
njams.sdk.communication.jms.java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
njams.sdk.communication.jms.java.naming.security.principal=admin
njams.sdk.communication.jms.java.naming.security.credentials=admin
njams.sdk.communication.jms.java.naming.provider.url=tcp\://localhost\:61616

Sample configuration of a JMS Data Provider using TIBCO EMS:

########## SDK configuration ##########
### Communication settings ###
njams.sdk.communication=JMS

### JMS settings ###
njams.sdk.communication.jms.connectionFactory=ConnectionFactory
njams.sdk.communication.jms.username=njams
njams.sdk.communication.jms.password=njams
njams.sdk.communication.jms.destination=njams.prod

### JNDI settings ###
njams.sdk.communication.jms.java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
njams.sdk.communication.jms.java.naming.security.principal=njams
njams.sdk.communication.jms.java.naming.security.credentials=njams
njams.sdk.communication.jms.java.naming.provider.url=tibjmsnaming://localhost:7222
Communication over Kafka:

Sample configuration for Kafka:

########## Kafka Connection ##########
njams.sdk.communication=kafka
njams.sdk.communication.kafka.client.bootstrap.servers=localhost:9092,192.168.0.5:9092
njams.sdk.communication.kafka.topicPrefix=njams
njams.sdk.communication.kafka.replyProducerIdleTime=30000

### Passed to Kafka ###
njams.sdk.communication.kafka.client.*
njams.sdk.communication.kafka.consumer.*
njams.sdk.communication.kafka.producer.*
njams.sdk.communication.kafka.admin.*

Subagent#

nJAMS Subagent is used to provide metrics information collected from nJAMS Client for Mule4 to an nJAMS Agent. The nJAMS Agent in turn forwards metrics information to nJAMS Argos, which is part of nJAMS Server.

The following properties configure nJAMS Subagent:

njams.sdk.subagent.enabled:

Turn on/off nJAMS Subagent.

true enables nJAMS Subagent.

false disables nJAMS Subagent (default).

njams.sdk.subagent.host:

Name of the server that hosts nJAMS Agent service. Enter a hostname or ip-address, default is 127.0.0.1.

njams.sdk.subagent.port:

Port number of nJAMS Agent service, default is 6450.

Sample settings for Subagent:

# Enable Subagent and configure against nJAMS Agent on localhost:
njams.sdk.subagent.enabled=true
njams.sdk.subagent.host=127.0.0.1
njams.sdk.subagent.port=6450

Configuration provider#

nJAMS Client for Mule4 must persist dynamic configuration information such as Trace Points and Extracts. The client offers different options to persist that configuration: objectsore or file.

When deploying to MuleSoft CloudHub any restart of the application will erase any configuration stored in a local file. To overcome this and retain settings over the application’s lifecycle, using a persistent objectstore is the best option.

njams.sdk.configuration.provider:

Specifies configuration provider, respectively the location where nJAMS Client for Mule4 stores the application based configuration.

objectstore sets the configuration provider to use (persistent) object store (default).

file stores configuration on storage device.

memory just temporarily stores configuration in memory.

njams.sdk.configuration.objectstore.name:

The name of the object store to use. Default is _defaultPersistentObjectStore.

njams.sdk.configuration.objectstore.refreshinterval:

Defines how frequently to refresh the configuration in the objectstore in minutes. Default is 60 minutes. MuleSoft CloudHub will expire objectstore entries after 30 days of inactivity.

njams.sdk.configuration.file.file:

The path to the configuration file to use. If not set, the following default value will be used: <MULE_WORKING_DIRECTORY>/njams/<njams.mule.domain>_<njams.mule.deployment>_<njams.mule.engine>.json Must end with .json suffix, when pointing to a file. If the path points to an existing file, that file will be used. If it points to a directory, a file with a default name will be created in that directory. Directories will be created automatically.

Sample configuration for using objectstore:

# Configuration store: objectstore
njams.sdk.configuration.provider=objectstore
njams.sdk.configuration.objectstore.name=_defaultPersistentObjectStore
njams.sdk.configuration.objectstore.refreshinterval=60

Memory Management#

The following properties are not required to be changed in most cases. Please only change these values, if you are fully aware of the effects!

njams.sdk.discardpolicy:

The discard policy determines how to deal with log messages, when maxQueueLength is exceeded.

none No message will be discarded, the Mule application will be blocked until queue size is below threshold (default).

discard will discard of the message.

OnConnectionLoss only discards log messages, if there is no connection available to JMS or to Cloud provider. Otherwise the Mule application is slowed down until all log messages are sent, respectively queue size is below threshold.

njams.sdk.flush_interval:

Period of time for collecting events in a message. Enter integer value in seconds. Default is 30.

njams.sdk.flushsize:

Maximum internal message size. If size of internal message is reached, an instant push is triggered. Enter any integer value > 0 in Byte. Default is 5242880.

njams.sdk.minqueuelength:

Minimum internal queue size to prepare log messages for sending. Enter any integer value > 0. Default is 1.

njams.sdk.maxqueuelength:

Maximum internal queue size to prepare log messages for sending. Enter any integer value > 0. Default is 8.

njams.sdk.senderthreadidletime:

Idle connection timeout to close and remove JMS connection in msec. Default is 10000.

Data Masking#

njams.sdk.datamasking.enabled:

Data Masking allows you to mask particular parts of the log message, which should remain confidential. Assume you have Tracing enabled for an activity that processes password information. By default, the nJAMS UI provides Trace Data including the password information in plain text. To prevent password information from being shown in plain text, you can use data masking.

This property corresponds to property njams.sdk.datamasking.regex.<your-regex-name>, which specifies the data masking pattern.

true enables data masking (default). Use njams.sdk.datamasking.regex.<your-regex-name> to specify data masking pattern.

false disables data masking.

njams.sdk.datamasking.regex.<your-regex-name>:

Use a regular expression to specify a pattern for data masking.

For example, the following regular expression replaces any information that matches a Social Security Number (SSN) with an asterisk character (“*”):

njams.sdk.datamasking.regex.maskSSN = (?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}

You can specify multiple regex definitions by defining further properties of regular expressions:

njams.sdk.datamasking.regex.mask1=my_first_regex

njams.sdk.datamasking.regex.mask2=my_second_regex

etc.

Advanced Settings#

Sample configuration for Advanced Settings:

########## Advanced Settings ##########
njams.sdk.logAllErrors=false
njams.sdk.communication.containerMode=false
njams.sdk.disable.secure.processing=false
njams.sdk.bootstrap.recording=true

### Memory Management ###
njams.sdk.flushsize=5242880
njams.sdk.flush_interval=30
njams.sdk.minsenderthreads=1
njams.sdk.maxsenderthreads=8
njams.sdk.maxqueuelength=8
njams.sdk.senderthreadidletime=10000
njams.sdk.discardpolicy=none|onconnectionloss|discard
njams.sdk.communication.shared=true|false

### Truncate ###
njams.sdk.truncateActivitiesLimit=100
njams.sdk.truncateOnSuccess=false

### Payload Limit ###
njams.sdk.payload.limit.mode=truncate|discard
njams.sdk.payload.limit.size=1024

### Log ###
njams.sdk.logMode.default=none|exclusive|complete
njams.sdk.logLevel.default=info|success|warning|error

Additional properties#

The following properties in nJAMS Client for Mule specify the representation of the Mule deployment hierarchy:

njams.mule.domain:

Specifies domain name, represented at level 1 of the domain object tree in nJAMS.

njams.mule.deployment:

Specifies deployment name, represented at level 2 of the domain object tree in nJAMS.

njams.mule.engine:

Specifies application name, represented at level 3 of the domain object tree in nJAMS.

Sample configuration of nJAMS Client for Mule4 taxonomy:

# Taxonomy:
njams.mule.domain=my_domain
njams.mule.deployment=my_deployment
njams.mule.engine=my_application

Please note, these are the previous properties for the taxonomy, which are now deprecated:

# Taxonomy:
njams.mule.domain=my_domain
njams.mule.deployment=my_deployment
njams.mule.engine=my_application

Note

When you are using Mule RTF it is recommended to configure the taxonomy in order to avoid getting new entries in the domain object tree each time you start the Mule application.

Use encrypted passwords#

In njams configuration files passwords are usually entered in plain text, such as njams.sdk.communication.jms.password=foo. In case you do not want to use uncoded passwords, you can use encrypted passwords as follows:

Assume, the password of your JMS account is foo:

  1. Call java -jar njams-sdk-5.x.x.jar foo will output encrypted password: ??0190029006d0048004c0055000c0017002d00090005006a004d007100b500bd

  2. Place encrypted password into njams.properties at njams.sdk.communication.jms.password=??0190029006d0048004c0055000c0017002d00090005006a004d007100b500bd

  3. Restart Mule application to make change effective