diff options
author | vlad <vlad@driver.xyz> | 2017-07-07 15:31:12 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-07-07 15:31:12 -0700 |
commit | 18d50eabc4476c0f1c6a1d776fc380e3968846d8 (patch) | |
tree | b68cd9cdd8ee1ec48863c885f389931115170482 /src/main/scala/xyz/driver/core | |
parent | 4eb6e3f2433e6216bce2978d2dc6a2c8d225331f (diff) | |
download | driver-core-0.13.20.tar.gz driver-core-0.13.20.tar.bz2 driver-core-0.13.20.zip |
Fake pubsub implementationv0.13.20
Diffstat (limited to 'src/main/scala/xyz/driver/core')
-rw-r--r-- | src/main/scala/xyz/driver/core/pubsub.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/pubsub.scala b/src/main/scala/xyz/driver/core/pubsub.scala index d4c0849..e7e5d4a 100644 --- a/src/main/scala/xyz/driver/core/pubsub.scala +++ b/src/main/scala/xyz/driver/core/pubsub.scala @@ -60,6 +60,20 @@ object pubsub { } } + class FakePubsubPublisher[Message](topicName: String, log: Logger)( + implicit messageMarshaller: Marshaller[Message, String], + ex: ExecutionContext) + extends PubsubPublisher[Message] { + + type Result = Id[PubsubMessage] + + def publish(message: Message): Future[Result] = + Marshal(message).to[String].map { messageString => + log.info(s"Published a message to a fake pubsub with topic $topicName: $messageString") + generators.nextId[PubsubMessage]() + } + } + trait PubsubSubscriber { def stopListening(): Unit @@ -93,4 +107,8 @@ object pubsub { subscriber.stopAsync() } } + + class FakePubsubSubscriber extends PubsubSubscriber { + def stopListening(): Unit = () + } } |