-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SR-GQL 1.4.3 + reflect recent websocket changes
- Loading branch information
Showing
14 changed files
with
130 additions
and
273 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
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
142 changes: 0 additions & 142 deletions
142
...ystem/src/main/java/org/wildfly/extension/microprofile/graphql/SubscriptionWebSocket.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...c/main/java/org/wildfly/extension/microprofile/graphql/WildFlyGraphQLServerWebSocket.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,42 @@ | ||
package org.wildfly.extension.microprofile.graphql; | ||
|
||
import io.smallrye.graphql.entry.http.GraphQLServerWebSocket; | ||
|
||
import javax.websocket.OnClose; | ||
import javax.websocket.OnError; | ||
import javax.websocket.OnMessage; | ||
import javax.websocket.OnOpen; | ||
import javax.websocket.Session; | ||
import javax.websocket.server.ServerEndpoint; | ||
|
||
/** | ||
* WebSocket endpoint that exposes GraphQL over websockets. | ||
* Just wrap the original GraphQLServerWebSocket class from SmallRye. The reason we're not using it directly is that | ||
* I don't know how to make the deployer see the annotations on that class - if we try to use it directly then | ||
* the undertow deployer will fail. So we extend that class, re-declare its annotations and delegate everything to it. | ||
*/ | ||
@ServerEndpoint(value = "/graphql", subprotocols = { "graphql-transport-ws", "graphql-ws" }) | ||
public class WildFlyGraphQLServerWebSocket extends GraphQLServerWebSocket { | ||
|
||
@OnOpen | ||
public void onOpen(Session session) { | ||
super.onOpen(session); | ||
} | ||
|
||
@OnClose | ||
public void onClose(Session session) { | ||
super.onClose(session); | ||
} | ||
|
||
@OnError | ||
public void onError(Session session, Throwable throwable) { | ||
super.onError(session, throwable); | ||
} | ||
|
||
@OnMessage | ||
public void handleMessage(Session session, String message) { | ||
super.handleMessage(session, message); | ||
} | ||
|
||
|
||
} |
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
13 changes: 10 additions & 3 deletions
13
...t-vertx/src/test/java/org/wildfly/extras/graphql/test/client/vertx/typesafe/FunnyApi.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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
package org.wildfly.extras.graphql.test.client.vertx.typesafe; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import io.smallrye.graphql.api.Subscription; | ||
import io.smallrye.graphql.client.typesafe.api.GraphQLClientApi; | ||
import io.smallrye.mutiny.Multi; | ||
import org.eclipse.microprofile.graphql.Query; | ||
|
||
@GraphQLApi | ||
public interface FunnyApi { | ||
import java.io.Closeable; | ||
|
||
@GraphQLClientApi | ||
public interface FunnyApi extends Closeable { | ||
|
||
@Query("random") | ||
Funny getRandomFunny(); | ||
|
||
@Subscription("count") | ||
Multi<Integer> count(int fromInclusive, int toExclusive); | ||
|
||
} |
15 changes: 13 additions & 2 deletions
15
...rtx/src/test/java/org/wildfly/extras/graphql/test/client/vertx/typesafe/FunnyApiImpl.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 |
---|---|---|
@@ -1,14 +1,25 @@ | ||
package org.wildfly.extras.graphql.test.client.vertx.typesafe; | ||
|
||
import io.smallrye.graphql.api.Subscription; | ||
import io.smallrye.mutiny.Multi; | ||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Query; | ||
|
||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
public class FunnyApiImpl implements FunnyApi { | ||
@GraphQLApi | ||
public class FunnyApiImpl { | ||
|
||
@Override | ||
@Query("random") | ||
public Funny getRandomFunny() { | ||
Funny funny = new Funny(); | ||
funny.setNumber(ThreadLocalRandom.current().nextInt(1, 1000)); | ||
return funny; | ||
} | ||
|
||
@Subscription("count") | ||
public Multi<Integer> count(int fromInclusive, int toExclusive) { | ||
return Multi.createFrom().range(fromInclusive, toExclusive); | ||
} | ||
|
||
} |
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
Oops, something went wrong.