Configuration

The Notification Service is a separate service from the YOUnite Server. Communication between the two services is performed asynchronously using the message bus.

As a Spring Boot based application, configuration can be set using environment variables or a custom application.properties file.

Note
If adding an application.properties file, make sure it is in the same folder as the JAR file of the application, or somewhere else on the classpath. Spring prioritizes properties in an external (outside of the JAR file) application.properties file, so anything in this file will override the defaults.

YOUnite Server Configuration for Notifications

Notification support must be enabled before the YOUnite Server will begin sending messages to the Notification Server for delivery to consumers.

To enable notifications, in the YOUnite Server set the environment variable NOTIFICATIONS_ENABLED to true. Another option is to set the value notifications.enabled in application.properties to true.

YOUnite Notification Service Configuration

The following configuration options apply to the Notification Service via environment variables or application.properties.

Database Configuration

A PostgreSQL database is required to store notification registration information. The following configuration options apply:

Environment Variable application.properties variable Description Default Value

SPRING_DATASOURCE_URL

spring.datasource.url

JDBC Url of the data source

jdbc:postgresql://localhost:5432/notifications

SPRING_DATASOURCE_USERNAME

spring.datasource.username

Username for connections

younite

SPRING_DATASOURCE_PASSWORD

spring.datasource.password

Password for connections

younite

SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE

spring.datasource.hikari.maximumPoolSize

Connection pool size

10

Message Bus Configuration (for incoming Notifications and registrations)

The Notification Service uses the same message bus used by the YOUnite Server, so the message bus URL should match.

Note: A separate message bus may optionally be used for websocket consumers, which requires different configuration (see below).

Environment Variable application.properties variable Description Default Value

MESSAGE_BUS_URL

message.bus.url

Message bus URL

tcp://localhost:61616

MESSAGE_BUS_USERNAME

message.bus.username

Message bus username

artemis

MESSAGE_BUS_PASSWORD

message.bus.password

Message bus password

artemis

MESSAGE_BUS_SESSION_CACHE_SIZE

message.bus.session.cache.size

JMS session cache size

10

MESSAGE_BUS_DATA_NOTIFICATION_QUEUE_CONCURRENCY

message.bus.data.notification.queue.concurrency

Concurrency for data notifications*

5

MESSAGE_BUS_METADATA_NOTIFICATION_QUEUE_CONCURRENCY

message.bus.metadata.notification.queue.concurrency

Concurrency for metadata notifications*

5

MESSAGE_BUS_REGISTRATION_QUEUE_CONCURRENCY

message.bus.notification.registration.queue.concurrency

Concurrency for notification registrations*

2

*Concurrency for each queue represents the simultaneous number of messages that will be processed. The value is expressed as a range (ie 1-5). If expressed as a single number, a range is implied, starting from 1 (ie the default value 5 means 1-5).

Note
if concurrency of any queue is greater than 1, messages may be delivered out of order. HOWEVER, message grouping is used on data notifications to ensure that order is preserved for records with the same DR Key.

YOUnite API and Security Configuration

The Notification Service queries the YOUnite Server’s API for user permissions and to validate tokens.

Environment Variable application.properties variable Description Default Value

API_HOST

api.host

API host and port

http://localhost:8080

NOTIFICATION_SERVICE_CLIENT_ID

notification.service.client.id

Client ID of the Notification Service

notifications

NOTIFICATION_SERVICE_CLIENT_SECRET

notification.service.client.secret

Client Secret of the Notification Service

(none)

OIDC_ISSUER

oidc.issuer

URL of the Open ID Connect OAuth2 issuer. This value can be found in the discover document as issuer

http://localhost:8800/auth/realms/younite

Websocket configuration

Websockets use the STOMP protocol to send messages and handle subscriptions. For security purposes, WEBSOCKET_ALLOWED_ORIGINS must be set (see note below.)

Environment Variable application.properties variable Description Default Value

WEBSOCKET_ALLOWED_ORIGINS

websocket.allowed.origins

A comma-separated list of origins allowed*

http://localhost

WEBSOCKET_STOMP_ENDPOINT

websocket.stomp.endpoint

Endpoint to use for websockets (via STOMP)

/ws

*The YOUnite UI makes use of websockets and must be included on the list of allowed origins.

Kubernetes Hazelcast Discovery

In a Kubernetes environment, Hazelcast requires two configuration options so that nodes can discover each other:

Environment Variable application.properties variable Description Example

KUBERNETES_SERVICE

kubernetes.service

Name of the service

younite-notification-service

KUBERNETES_NAMESPACE

kubernetes.namespace

Kubernetes namespace

default

Message Broker Relay Configuration

The Notification Service uses its own separate message broker to coordinate sending messages to websockets and webhooks. This ensures that the Notification Service will work in a high availability scenario (multiple Notification Service servers with one message broker coordinating the messages). It also allows for retrying sending of messages that may be "stuck" if a webhook goes down temporarily.

Apache Artemis is the default/preferred message broker for the Notification Service.

Note
This message bus/broker may be the same as message bus used to communicate with the YOUnite Server, depending on the desired configuration.
Environment Variable application.properties variable Description Default Value

MESSAGE_BROKER_RELAY_ENABLED

message.broker.relay.enabled

Set to true to enable the relay

false

MESSAGE_BROKER_RELAY_HOST

message.broker.relay.host

Message broker host

localhost

MESSAGE_BROKER_RELAY_STOMP_PORT

message.broker.relay.stomp.port

Message broker port (STOMP protocol)

61613

MESSAGE_BROKER_RELAY_TCP_PORT

message.broker.relay.tcp.port

Message broker port (JMS protocol)

61616

MESSAGE_BROKER_RELAY_CLIENT_USER

message.broker.relay.client.user

Login to use on behalf of connected clients

guest

MESSAGE_BROKER_RELAY_CLIENT_PASSWORD

message.broker.relay.client.password

Password to use on behalf of connected clients

guest

MESSAGE_BROKER_RELAY_SYSTEM_USER

message.broker.relay.system.user

System login used to send messages

guest

MESSAGE_BROKER_RELAY_SYSTEM_PASSWORD

message.broker.relay.system.password

System password used to send messages

guest

Logstash Configuration (for sending logs to Elastic)

This configuration should match the configuration for the YOUnite Server.

Environment Variable application.properties Description Default Value

LOGGING_LOGSTASH_ENABLED

logging.logstash.enabled

Enable logging of requests through logstash (typically to send logs to elastic, but could be any supported source). This should normally be the same logging configuration as the YOUnite Server.

true

LOGGING_LOGSTASH_HOST

logging.logstash.host

Logstash host name.

localhost

LOGGING_LOGSTASH_PORT

logging.logstash.port

Logstash port.

4560

LOGGING_LOGSTASH_ENABLE_SSL

logging.logstash.enable.ssl

Enable SSL for logstash.

false

LOGGING_LOGSTASH_TRUSTSTORE_LOCATION

logging.logstash.truststore.location

Location of the trust store file, if using custom SSL certificates. Must be in jks (Java KeyStore) format.

LOGGING_LOGSTASH_TRUSTSTORE_PASSWORD

logging.logstash.truststore.password

Password for the trust store file, if using custom SSL certificates.

Other Configuration

Environment Variable application.properties variable Description Default Value

ULTIMATE_ROOT_ZONE_UUID

ultimate.root.zone.uuid

UUID of the Root zone in YOUnite. Must match the configuration of the YOUnite Server. Normally does not need to be changed.

6c5a754b-6ce0-4871-8dec-d39e255eccc3

SUBSCRIPTION_VERIFICATION_RATE_MINUTES

subscription.verification.rate.minutes

Time is minutes to perform the background task of verifying subscriptions and removing expired sessions.

30

High Availability

The YOUnite Notification Service is scalable, using Hazelcast to synchronize it’s in memory data stores, and a message broker to coordinate sending messages. For Hazelcast to work correctly, the following must apply: