public class AtmosphereStompAdapterImpl extends Object implements AtmosphereStompAdapter
Default AtmosphereStompAdapter used by Atmosphere framework.
| Constructor and Description |
|---|
AtmosphereStompAdapterImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(org.atmosphere.cpr.AtmosphereResource atmosphereResource,
Map<String,String> headers)
Aborts a transaction began by the given
AtmosphereResource. |
void |
begin(org.atmosphere.cpr.AtmosphereResource atmosphereResource)
Begins a transaction for the given
AtmosphereResource. |
void |
commit(org.atmosphere.cpr.AtmosphereResource atmosphereResource,
Map<String,String> headers)
Commits a transaction started by the given
AtmosphereResource. |
void |
send(org.atmosphere.cpr.AtmosphereResource atmosphereResource,
Map<String,String> headers,
String body,
org.atmosphere.cpr.AtmosphereFramework framework)
Invokes the method annotated with
StompService inside any
ManagedService that defines a destination that matched the destination
String inside the specified Strings. |
void |
subscribe(org.atmosphere.cpr.AtmosphereResource resource,
Map<String,String> headers,
org.atmosphere.cpr.AtmosphereFramework framework)
Adds the given
AtmosphereResource to the Broadcaster identified with the path
specified in the given Strings. |
void |
unsubscribe(org.atmosphere.cpr.AtmosphereResource resource,
Map<String,String> headers,
org.atmosphere.cpr.AtmosphereFramework framework)
Removes the given
AtmosphereResource from the Broadcaster identified with the
path specified in the given Strings. |
public void subscribe(org.atmosphere.cpr.AtmosphereResource resource,
Map<String,String> headers,
org.atmosphere.cpr.AtmosphereFramework framework)
throws IOException
Adds the given AtmosphereResource to the Broadcaster identified with the path
specified in the given Strings. The AtmosphereResource lifecycle is then delegated
to the Broadcaster used by the Atmosphere framework.
subscribe in interface AtmosphereStompAdapterresource - the AtmosphereResource that sent the subscription frameheaders - the Strings extracted from the message that contain the destination pathframework - the AtmosphereFrameworkIOException - if request can't be processedBroadcaster.addAtmosphereResource(org.atmosphere.cpr.AtmosphereResource)public void unsubscribe(org.atmosphere.cpr.AtmosphereResource resource,
Map<String,String> headers,
org.atmosphere.cpr.AtmosphereFramework framework)
throws IOException
Removes the given AtmosphereResource from the Broadcaster identified with the
path specified in the given Strings.
unsubscribe in interface AtmosphereStompAdapterresource - the AtmosphereResource that sent the unsubscription frameheaders - the Strings extracted from the message that contain the destination pathframework - the AtmosphereFrameworkIOException - if request can't be processedBroadcaster.removeAtmosphereResource(org.atmosphere.cpr.AtmosphereResource)public void send(org.atmosphere.cpr.AtmosphereResource atmosphereResource,
Map<String,String> headers,
String body,
org.atmosphere.cpr.AtmosphereFramework framework)
throws IOException
Invokes the method annotated with StompService inside any
ManagedService that defines a destination that matched the destination
String inside the specified Strings.
The result of the method invocation is dispatched by the Broadcaster identified with
the path specified in the given Strings. If no annotated method matches the requested send,
then the body is dispatched. Original body or result are sent in a Action.MESSAGE
frame. Finally, if the method invocation throws an exception, then an Action.ERROR
is sent only to the specified AtmosphereResource that sent the frame.
Note that Broadcaster must not do anything if a transaction has been started by the
AtmosphereResource and if this transaction is referenced in frame's Strings.
send in interface AtmosphereStompAdapteratmosphereResource - the atmosphere resource that sent the sendheaders - the Strings extracted from the message that contain the destination path and optionally a transaction IDbody - the body extracted from the frameframework - the AtmosphereFrameworkIOException - if request can't be processedAtmosphereStompAdapter.begin(org.atmosphere.cpr.AtmosphereResource)public void begin(org.atmosphere.cpr.AtmosphereResource atmosphereResource)
Begins a transaction for the given AtmosphereResource.
A transaction ID is generated that could be specified in future Action.SEND
to include their result in the transaction.
In that case, all AtmosphereStompAdapter.send(org.atmosphere.cpr.AtmosphereResource, java.util.Map, String, AtmosphereFramework)
operation results won't be dispatched by the Broadcaster until the AtmosphereResource
sends a commit frame for the associated transaction ID.
begin in interface AtmosphereStompAdapteratmosphereResource - the AtmosphereResource that begins the transactionpublic void commit(org.atmosphere.cpr.AtmosphereResource atmosphereResource,
Map<String,String> headers)
Commits a transaction started by the given AtmosphereResource.
All AtmosphereStompAdapter.send(org.atmosphere.cpr.AtmosphereResource, java.util.Map, String, AtmosphereFramework) operation results
associated to the transaction ID specified in Strings are dispatched by the Broadcaster.
commit in interface AtmosphereStompAdapteratmosphereResource - the AtmosphereResource that begins the transactionheaders - the Strings that contain the transaction IDpublic void abort(org.atmosphere.cpr.AtmosphereResource atmosphereResource,
Map<String,String> headers)
Aborts a transaction began by the given AtmosphereResource.
All AtmosphereStompAdapter.send(org.atmosphere.cpr.AtmosphereResource, java.util.Map, String, AtmosphereFramework) operations
results associated to the transaction ID specified inside the given Strings are erased.
abort in interface AtmosphereStompAdapteratmosphereResource - the AtmosphereResource that aborts the transactionheaders - the Strings that contain the transaction IDCopyright © 2014. All Rights Reserved.