Skip to content

Commit

Permalink
feat: allow to obtain connector status
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumelamirand committed Mar 5, 2024
1 parent 11a1a70 commit 49f9d36
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 21 deletions.
4 changes: 2 additions & 2 deletions gravitee-exchange-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-api</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
<name>Gravitee.io - Exchange - API</name>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public interface Channel {
*/
Completable close();

/**
* Return <code>true</code> is the current channel is active and ready to receive new commands, <code>false</code> otherwise.
*
* @return status of the channel.
*/
boolean isActive();

/**
* Send the actual commands to the current channel. In case of error, different exception could be returned:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,17 @@ public interface ExchangeConnector {
*/
String targetId();

/**
* Return <code>true</code> when the current instance is active and ready, <code>false</code> otherwise.
*
* @return status of the connector.
*/
boolean isActive();

/**
* Returns <code>true</code> when the current instance is PRIMARY.
*
* @return boolean
* @return boolean about primary status
*/
boolean isPrimary();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
* @author GraviteeSource Team
*/
public interface ControllerChannel extends Channel {
/**
* Return <code>true</code> is the current channel is active and ready to receive new commands, <code>false</code> otherwise.
*
* @return status of the channel.
*/
boolean isActive();

/**
* Enforce the active status of this controller channel.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public String targetId() {
return targetId;
}

@Override
public boolean isActive() {
return this.active;
}

@Override
public Completable initialize() {
return Completable.create(emitter -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.gravitee.exchange.api.websocket.protocol.legacy.goodbye;

import io.gravitee.exchange.api.command.CommandAdapter;
import io.gravitee.exchange.api.command.ReplyAdapter;
import io.gravitee.exchange.api.command.goodbye.GoodByeReplyPayload;
import io.reactivex.rxjava3.core.Single;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange-connector</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-connector-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange-connector</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-connector-embedded</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public String targetId() {
return connectorChannel.targetId();
}

@Override
public boolean isActive() {
return connectorChannel.isActive();
}

@Override
public boolean isPrimary() {
return primary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange-connector</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-connector-websocket</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-exchange-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-connector</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange-controller</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-controller-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange-controller</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-controller-embedded</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange-controller</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-controller-websocket</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
<name>Gravitee.io - Exchange - Controller Websocket</name>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion gravitee-exchange-controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
</parent>

<artifactId>gravitee-exchange-controller</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<groupId>io.gravitee.exchange</groupId>
<artifactId>gravitee-exchange</artifactId>
<version>1.0.0-alpha.4</version>
<version>1.0.0-alpha.5</version>
<name>Gravitee.io - Exchange</name>
<packaging>pom</packaging>

Expand Down

0 comments on commit 49f9d36

Please sign in to comment.