Receiving Notifications in a standalone Java server

This topic has 4 replies, 2 voices, and was last updated 6 years, 6 months ago by Peter Major.

  • Author
    Posts
  • #9171

    I’ve write a few classes to communicate with OpenAM with the help of the Client SDK.
    This classes works fine in a standalone application, so no jee server required.
    This is done creating and endpoint that receives the notification message.
    The configuration of the Client SDK is done with pure Java, and not with the AMConfig.properties file.

    I can see the notifications received, and in the OpenAM server I can see the log messages referring to the client endpoint.

    I’ve just added a Listener to the ShutdownManager, and I pass the “-Dopenam.runtime.shutdown.hook.enabled=true”. The listener stops the endpoint, I see the log messages about that. But the OpenAM server tries to send the notification messages to the stopped endpoint, so I think I missed something like ‘deregister’ the notification endpoint to stop the notifications.

    The message I can see in the server log is:

    ERROR: Cannot send notification to http://A.B.C.D:8181/notificationListener.

    Where A.B.C.D is my private IP.

    What I am missing in this scenery?
    I need to know how it works the “de-register” client notification url.

    Thank you for your help and your time.

    #9173

    Sorry, the correct topic should be: Receiving Notifications in a standalone Java application

    #9206
     Peter Major
    Moderator

    I’m not sure if the ClientSDK actually deregisters listeners upon shutdown. It certainly performs some kind of cleanup, but it’s most likely not going to go through all the session IDs and try to deregister the session listeners.

    #9208

    Thank you for your answer.
    I have two questions about that:

    1. When you say “session IDs”, are you referring to the session IDs in SDK cache?
    2. The client is not running, but OpenAM tries to send it notifications, so OpenAM keeps the URL in its internal data structure. Is it possible to see the list of listeners in the web admin interface or calling a REST service? I read an old article about OpenSSO (I think it is valid in OpenAM) about entitlements and listeners, with three operations: adding, retrieving and deleting, but it has not listing.
    3. The sessions in OpenAM expires after a time. Is it possible that OpenAM doesn’t remove that when the session ID contains a session listener?
    4. I think that restarting OpenAM would clean the pending notifications in the server, to stop the log messages. Is there any other way to get that without restarting the OpenAM?

    I am reading the code and some articles about that, to imagine a way to fix my problem.
    If you can say me about the entitlements in the Client SDK (for example, if exists a class to perform the listener entitlement operations) it would be great.

    #9356
     Peter Major
    Moderator

    1) yes
    2) listeners are registered for individual sessions normally (there is a server-wide notification option as well, but IIRC the ClientSDK doesn’t use that), there is no way to retrieve a list of them without actually traversing through all the active sessions in the system.
    3) nope
    4) don’t shut down your clientsdk app? (I mean is this a valid use-case?)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?