forked from eclipse-hono/hono
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-hono#565] Implement protocol connection events
- Loading branch information
Showing
3 changed files
with
167 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
service-base/src/main/java/org/eclipse/hono/service/ConnectionEventProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright (c) 2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 1.0 which is available at | ||
* https://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* SPDX-License-Identifier: EPL-1.0 | ||
*/ | ||
package org.eclipse.hono.service; | ||
|
||
import org.eclipse.hono.service.auth.device.Device; | ||
|
||
/** | ||
* Produces connection events. | ||
* <p> | ||
* The interface is intended to be implemented by setups which are interested in receiving technical connection events. | ||
* Which might not make sense for all protocols adapters. But mostly for connection oriented ones like MQTT or AMQP 1.0. | ||
* <p> | ||
* The protocol adapters may call {@link #connected(String, Device)} and {@link #disconnected(String, Device)} as they | ||
* see fit. The whole process is a "best effort" process and intended to be used for monitoring/debugging. | ||
* <p> | ||
* When a protocol adapter calls into this producer it must provide some kind of connection ID, which might have a | ||
* different meaning for different protocol adapters. This should be as identifiable as possible but there is no | ||
* requirement for this to be unique. However for each connection the protocol adapter must call | ||
* {@link #disconnected(String, Device)} with the same information as it called {@link #connected(String, Device)}. | ||
*/ | ||
public interface ConnectionEventProducer { | ||
|
||
/** | ||
* Produce an event for a new connection. | ||
* | ||
* @param connectionIdentifier The ID of the connection which connected. | ||
* @param authenticatedDevice The optional authenticated device associated with the connection. May be {@code null}. | ||
*/ | ||
public void connected(String connectionIdentifier, Device authenticatedDevice); | ||
|
||
/** | ||
* Produce an event for a closed connection. | ||
* | ||
* @param connectionIdentifier The ID of the connection which disconnected. | ||
* @param authenticatedDevice The optional authenticated device associated with the connection. May be {@code null}. | ||
*/ | ||
public void disconnected(String connectionIdentifier, Device authenticatedDevice); | ||
|
||
} |