...
In the snippet above an implementation of BiFunction<Connection, URI, Object>
is created at (3) to for access token provisioning. The function implementation checks the token expiration at (4) and regenerate the token at (5) using a helper object (2) implementing calls to OAUTH2 specific API. The token expiration time is preserved at (6) for the following reconnects attempts. An instance of JmsConnectionFactory
is created at (7) for a given brokerURI (1). A password extension is registered at (8). JMS connection is open at (9). The example uses a hypothetical class TokenGenerator
invoking underlying OAUTH2 API to generate/renew access token and get token expiration time.
...