final class DatasyncManager extends AnyRef
- Alphabetic
- By Inheritance
- DatasyncManager
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new DatasyncManager(optSystem: Option[ActorSystem], optExecutor: Option[ExecutionContextExecutor], optMaterializer: Option[ActorMaterializer])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
createAppClient(app: String): DatasyncClient
Obtains a
DatasyncClient
bound to an application (formerly known as 'namespace') on Flexible Datasync.Obtains a
DatasyncClient
bound to an application (formerly known as 'namespace') on Flexible Datasync. Example:// --------------- // SCALA // --------------- val manager = DatasyncManager() val client = manager.createAppClient("my-datasync-app") // --------------- // JAVA // --------------- final static DatasyncManager manager = DatasyncManager.create(); final static DatasyncClient client = manager.createAppClient("my-datasync-app");
- app
the name of an application.
- returns
a
DatasyncClient
-
def
createAppClient(app: String, token: String): Future[(DatasyncClient, Source[AuthMessage, SourceQueueWithComplete[Any]])]
Scala API.
Scala API. Asynchronously obtains an already authenticated
DatasyncClient
bound to an application (formerly known as 'namespace') on Flexible Datasync. The akka streamSource
additionally returned allows authentication monitoring. Example:val manager = DatasyncManager() val token = "eyJhbGc ... _yz8dN9gssZV9kS8ONgr7s" val futureClient = manager.createAppClient("my-datasync-app", token).andThen { case Success((dc, source)) => logger.info("CLIENT CREATION AND AUTHENTICATION SUCCESS") source.toMat(Sink.foreach(am => logger.debug(s"Event received: $am")))(Keep.left) .run() case Failure(t) => logger.error(s"CLIENT CREATION AND AUTHENTICATION ERROR: ${t.getMessage}", t) }.map(_._1) // then use futureClient, a Future[DatasyncClient] to do useful things...
This may return some log like the following:
Event received: AuthRevokedMessage(expired_token, Auth token is expired.)
- app
the name of an application.
- token
the token used to authenticate on Datasync.
- returns
a
Future[(DatasyncClient, Source[AuthMessage, SourceQueueWithComplete[Any]])]
- Exceptions thrown
AuthenticateException
if authentication process failedAuthenticateTimeoutException
if authentication process timed out (automatic re-connection may occur)DatasyncUnavailableException
if Web Socket connection fails while trying to authenticateIllegalArgumentException
if token is null or empty
-
def
createAppClientJ(app: String, token: String): CompletionStage[(DatasyncClient, Source[AuthMessage, SourceQueueWithComplete[Any]])]
Java API.
Java API. Asynchronously obtains an already authenticated
DatasyncClient
bound to an application (formerly known as 'namespace') on Flexible Datasync. The akka streamSource
additionally returned allows authentication monitoring. Example:final static DatasyncManager manager = DatasyncManager.create(); final static String token = "eyJhbGc ... _yz8dN9gssZV9kS8ONgr7s"; CompletionStage<DatasyncClient> futureClient = manager.createAppClient("my-datasync-app", token).handleAsync((tuple, ex) -> { if (tuple != null) { System.out.printf("CLIENT CREATION AND AUTHENTICATION SUCCESS \n"); tuple._2.runWith( Sink.foreach(am -> System.out.printf("Event received: %s \n", am)), manager.materializer()); } else { System.out.printf("CLIENT CREATION AND AUTHENTICATION ERROR: %s \n", ex.getMessage()); } return tuple._1; }); // then use futureClient to do useful things...
This may return some log like the following:
Event received: AuthRevokedMessage(expired_token, Auth token is expired.)
- app
the name of an application.
- token
the token used to authenticate on Datasync.
- returns
a
CompletionStage<(DatasyncClient, Source<AuthMessage, SourceQueueWithComplete<Any>>)>
- Exceptions thrown
AuthenticateException
if authentication process failedAuthenticateTimeoutException
if authentication process timed out (automatic re-connection may occur)IllegalArgumentException
if token is null or empty
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
executor: ExecutionContextExecutor
Retrieves the Execution Context Executor this
DatasyncManager
relies on.Retrieves the Execution Context Executor this
DatasyncManager
relies on. This may be useful when Execution Context Executor is built by thisDatasyncManager
(i.e. you did not provide it) Example:// --------------- // SCALA // --------------- val manager = DatasyncManager() implicit val executor: ExecutionContextExecutor = manager.executor // --------------- // JAVA // --------------- final static DatasyncManager manager = DatasyncManager.create(); final static ExecutionContextExecutor executor = manager.executor();
- returns
an
ExecutionContextExecutor
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val log: DiagnosticMarkerBusLoggingAdapter
-
val
materializer: ActorMaterializer
Retrieves the Actor Materializer this
DatasyncManager
relies on.Retrieves the Actor Materializer this
DatasyncManager
relies on. This may be useful when Actor Materializer is built by thisDatasyncManager
(i.e. you did not provide it) Example:// --------------- // SCALA // --------------- val manager = DatasyncManager() implicit val materializer: ActorMaterializer = manager.materializer // --------------- // JAVA // --------------- final static DatasyncManager manager = DatasyncManager.create(); final static ActorMaterializer materializer = manager.materializer();
- returns
an
ActorMaterializer
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
val
system: ActorSystem
Retrieves the Actor System this
DatasyncManager
relies on.Retrieves the Actor System this
DatasyncManager
relies on. This may be useful when Actor System is built by thisDatasyncManager
(i.e. you did not provide it) Example:// --------------- // SCALA // --------------- val manager = DatasyncManager() implicit val system: ActorSystem = manager.system // --------------- // JAVA // --------------- final static DatasyncManager manager = DatasyncManager.create(); final static ActorSystem system = manager.system();
- returns
an
ActorSystem
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )