new MissingTopicHandler()
Handler called when a client session subscribes or fetches using a topic selector that matches no topics. This interface must be implemented by the user.
Handler instances can be registered using addMissingTopicHandler.
Methods
-
onClose(topicPath)
-
Called when the handler is closed. The handler will be closed if the session is closed, or if the handler is unregistered.
Once closed, no further calls will be made for the handler.
Parameters:
Name Type Description topicPath
String The registration path
-
onError(topicPath, error)
-
Notification of a contextual error related to this handler. This is analogous to an unchecked exception being raised. Situations in which
onError
is called include the session being closed before the handler is registered, a communication timeout, or a problem with the provided parameters. No further calls will be made to this handler.Parameters:
Name Type Description topicPath
String The registration path
error
Object The error
-
onMissingTopic(notification)
-
Called when a client session requests a topic that does not exist, and the topic path belongs to part of the topic tree for which this handler was registered.
Missing topic notifications only occur when using the deprecated Session#fetch mechanism. The newer Session#fetchRequest mechanism does not generate missing topic notifications.
The handler implementation should take the appropriate action (for example, create the topic), and then call proceed on the supplied
notification
. This allows the client request to continue and successfully resolve against the topic if it was created.Alternatively, the handler can call cancel to discard the request. A handler should always call
proceed
orcancel
, otherwise resources will continue to be reserved on the server until the notification times out.Parameters:
Name Type Description notification
MissingTopicNotification The missing topic notification
-
onRegister(path, deregister)
-
Called when the handler has been successfully registered with the server.
A session can register a single handler for a given branch of the topic tree. If there is already a handler registered for the topic path the operation will fail and onClose will be called.
To deregister the handler, call the
deregister
function supplied.Parameters:
Name Type Description path
String The registration path
deregister
function A function that may be called to deregister this handler