Sink inside Actor invoked during prod, but not during test Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Using ScalaTest to test akka actorsHow to test that Akka actor was created in ScalaTesting Actors in AkkaAkka: testing actor got messageUnit test async scala codeTest actors creation in akka hooks (preStart)How do I test an Akka actor that sends a message to another actor?How to deal with future inside a customized akka Sink?How to wait for Akka actor to start during tests?Actors as sink and source for Akka websockets

Is there a verb for listening stealthily?

Assertions In A Mock Callout Test

Who can become a wight?

How can I introduce the names of fantasy creatures to the reader?

Salesforce - multiple pre production environments

2 sample t test for sample sizes - 30,000 and 150,000

Does the universe have a fixed centre of mass?

Lights are flickering on and off after accidentally bumping into light switch

Why not use the yoke to control yaw, as well as pitch and roll?

Why these surprising proportionalities of integrals involving odd zeta values?

What's the connection between Mr. Nancy and fried chicken?

"Destructive force" carried by a B-52?

Why doesn't the university give past final exams' answers?

Trying to enter the Fox's den

“Since the train was delayed for more than an hour, passengers were given a full refund.” – Why is there no article before “passengers”?

Determine the generator of an ideal of ring of integers

Short story about an alien named Ushtu(?) coming from a future Earth, when ours was destroyed by a nuclear explosion

When speaking, how do you change your mind mid-sentence?

Are Flameskulls resistant to magical piercing damage?

Married in secret, can marital status in passport be changed at a later date?

Can I take recommendation from someone I met at a conference?

Do chord progressions usually move by fifths?

Does traveling In The United States require a passport or can I use my green card if not a US citizen?

Weaponising the Grasp-at-a-Distance spell



Sink inside Actor invoked during prod, but not during test



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Using ScalaTest to test akka actorsHow to test that Akka actor was created in ScalaTesting Actors in AkkaAkka: testing actor got messageUnit test async scala codeTest actors creation in akka hooks (preStart)How do I test an Akka actor that sends a message to another actor?How to deal with future inside a customized akka Sink?How to wait for Akka actor to start during tests?Actors as sink and source for Akka websockets



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have an actor that invokes a stream. At runtime this works as intended, but when tested the stream is not invoked.



The Actor (abbreviated)



class PaymentProcessorActor(repo: PaymentRepo, accountCache: AccountCache, config: AppConfig) extends Actor {

implicit private val materializer: ActorMaterializer = ActorMaterializer()
implicit private val network: Network = config.network
private implicit val ec: ExecutionContextExecutor = context.dispatcher

val paymentSink: Sink[(Seq[Payment], Account), NotUsed] =
Flow[(Seq[Payment], Account)].map case (ps, account) =>
println("inside flow")
// ... block of type Future[(TransactionResponse, Seq[Payment], Account)] here

.mapAsync(parallelism = config.accounts.size)(_.map
case ((_: TransactionApproved, ps), account) =>
// handle approval

case ((x: TransactionRejected, ps), account) =>
// handle rejection
)
.to(Sink.ignore)

override def receive: Receive = state(nextKnownPaymentDate = None)

private def state(nextKnownPaymentDate: Option[ZonedDateTime]): Receive =
processPayments(nextKnownPaymentDate) orElse
updateNextPaymentTime orElse
confirmPayments orElse
rejectPayments orElse
rejectTransaction orElse
retryPayments orElse
updateAccount orElse
registerAccount


// If there are payments due, find and pay them
def processPayments(nextKnownPaymentDate: Option[ZonedDateTime]): PartialFunction[Any, Unit] =
case ProcessPayments if nextKnownPaymentDate.exists(_.isBefore(ZonedDateTime.now())) =>
val readyAccounts = accountCache.readyCount
if (readyAccounts > 0)
val payments = repo.due(readyAccounts * 100)
if (payments.isEmpty)
logger.debug("No more payments due.")
context.become(state(repo.earliestTimeDue))
else
val submittingPaymentsWithAccounts: Seq[(Seq[Payment], Account)] =
payments.grouped(100).flatMap(ps => accountCache.borrowAccount.map(ps -> _)).toSeq
val submittingPayments: Seq[Payment] = submittingPaymentsWithAccounts.flatMap(_._1)
repo.submit(submittingPayments.flatMap(_.id), ZonedDateTime.now)

Source.fromIterator(() => submittingPaymentsWithAccounts.iterator).to(paymentSink).run()
println("post source run")





The spec. (sampleOf just creates a random instance and is not pertinent to the problem).



 "the payment sink" should 
"submit to the network" in
val (network, conf, repo, cache) = setup
val account = sampleOf(genAccount)
val payments = sampleOf(Gen.listOfN(3, genPayment))
when(repo.earliestTimeDue).thenReturn(Some(ZonedDateTime.now()))
when(repo.due(100)).thenReturn(payments)

val actor = system.actorOf(Props(new PaymentProcessorActor(repo, cache, conf)))

// these two calls set up the actor state so that payments will be processed
actor ! UpdateNextPaymentTime
actor ! UpdateAccount(account)

// this invokes the stream under test
actor ! ProcessPayments

eventually(timeout(5 seconds))
assert(network.posted.size == 1)




private def setup: (StubNetwork, AppConfig, PaymentRepo, AccountCache) =
val n = StubNetwork()
val conf = new AppConfig
val network: Network = n
val accounts: Map[String, KeyPair] = Map.empty

val repo = mock[PaymentRepo]
(n, conf, repo, new AccountCache)



At runtime, I see the stdout messages:



post source run
inside flow


But during test I only see



post source run


With debugging, I see that all values are correct and the source .run is called. But somehow it does not run.










share|improve this question
























  • Not directly related to your question, but at "inside flow" why would you create a Future in a map rather than doing a mapAsync here? I sort of suspect there's blocking on the dispatcher somewhere, but don't see it here directly.

    – Arnout Engelen
    Mar 9 at 8:40












  • Thanks for your comment @ArnoutEngelen. I call out to a library function which returns a Future. The full block being github.com/0rora/0rora/blob/ba373e/app/models/… Does that look problematic?

    – Synesso
    Mar 11 at 4:51

















0















I have an actor that invokes a stream. At runtime this works as intended, but when tested the stream is not invoked.



The Actor (abbreviated)



class PaymentProcessorActor(repo: PaymentRepo, accountCache: AccountCache, config: AppConfig) extends Actor {

implicit private val materializer: ActorMaterializer = ActorMaterializer()
implicit private val network: Network = config.network
private implicit val ec: ExecutionContextExecutor = context.dispatcher

val paymentSink: Sink[(Seq[Payment], Account), NotUsed] =
Flow[(Seq[Payment], Account)].map case (ps, account) =>
println("inside flow")
// ... block of type Future[(TransactionResponse, Seq[Payment], Account)] here

.mapAsync(parallelism = config.accounts.size)(_.map
case ((_: TransactionApproved, ps), account) =>
// handle approval

case ((x: TransactionRejected, ps), account) =>
// handle rejection
)
.to(Sink.ignore)

override def receive: Receive = state(nextKnownPaymentDate = None)

private def state(nextKnownPaymentDate: Option[ZonedDateTime]): Receive =
processPayments(nextKnownPaymentDate) orElse
updateNextPaymentTime orElse
confirmPayments orElse
rejectPayments orElse
rejectTransaction orElse
retryPayments orElse
updateAccount orElse
registerAccount


// If there are payments due, find and pay them
def processPayments(nextKnownPaymentDate: Option[ZonedDateTime]): PartialFunction[Any, Unit] =
case ProcessPayments if nextKnownPaymentDate.exists(_.isBefore(ZonedDateTime.now())) =>
val readyAccounts = accountCache.readyCount
if (readyAccounts > 0)
val payments = repo.due(readyAccounts * 100)
if (payments.isEmpty)
logger.debug("No more payments due.")
context.become(state(repo.earliestTimeDue))
else
val submittingPaymentsWithAccounts: Seq[(Seq[Payment], Account)] =
payments.grouped(100).flatMap(ps => accountCache.borrowAccount.map(ps -> _)).toSeq
val submittingPayments: Seq[Payment] = submittingPaymentsWithAccounts.flatMap(_._1)
repo.submit(submittingPayments.flatMap(_.id), ZonedDateTime.now)

Source.fromIterator(() => submittingPaymentsWithAccounts.iterator).to(paymentSink).run()
println("post source run")





The spec. (sampleOf just creates a random instance and is not pertinent to the problem).



 "the payment sink" should 
"submit to the network" in
val (network, conf, repo, cache) = setup
val account = sampleOf(genAccount)
val payments = sampleOf(Gen.listOfN(3, genPayment))
when(repo.earliestTimeDue).thenReturn(Some(ZonedDateTime.now()))
when(repo.due(100)).thenReturn(payments)

val actor = system.actorOf(Props(new PaymentProcessorActor(repo, cache, conf)))

// these two calls set up the actor state so that payments will be processed
actor ! UpdateNextPaymentTime
actor ! UpdateAccount(account)

// this invokes the stream under test
actor ! ProcessPayments

eventually(timeout(5 seconds))
assert(network.posted.size == 1)




private def setup: (StubNetwork, AppConfig, PaymentRepo, AccountCache) =
val n = StubNetwork()
val conf = new AppConfig
val network: Network = n
val accounts: Map[String, KeyPair] = Map.empty

val repo = mock[PaymentRepo]
(n, conf, repo, new AccountCache)



At runtime, I see the stdout messages:



post source run
inside flow


But during test I only see



post source run


With debugging, I see that all values are correct and the source .run is called. But somehow it does not run.










share|improve this question
























  • Not directly related to your question, but at "inside flow" why would you create a Future in a map rather than doing a mapAsync here? I sort of suspect there's blocking on the dispatcher somewhere, but don't see it here directly.

    – Arnout Engelen
    Mar 9 at 8:40












  • Thanks for your comment @ArnoutEngelen. I call out to a library function which returns a Future. The full block being github.com/0rora/0rora/blob/ba373e/app/models/… Does that look problematic?

    – Synesso
    Mar 11 at 4:51













0












0








0








I have an actor that invokes a stream. At runtime this works as intended, but when tested the stream is not invoked.



The Actor (abbreviated)



class PaymentProcessorActor(repo: PaymentRepo, accountCache: AccountCache, config: AppConfig) extends Actor {

implicit private val materializer: ActorMaterializer = ActorMaterializer()
implicit private val network: Network = config.network
private implicit val ec: ExecutionContextExecutor = context.dispatcher

val paymentSink: Sink[(Seq[Payment], Account), NotUsed] =
Flow[(Seq[Payment], Account)].map case (ps, account) =>
println("inside flow")
// ... block of type Future[(TransactionResponse, Seq[Payment], Account)] here

.mapAsync(parallelism = config.accounts.size)(_.map
case ((_: TransactionApproved, ps), account) =>
// handle approval

case ((x: TransactionRejected, ps), account) =>
// handle rejection
)
.to(Sink.ignore)

override def receive: Receive = state(nextKnownPaymentDate = None)

private def state(nextKnownPaymentDate: Option[ZonedDateTime]): Receive =
processPayments(nextKnownPaymentDate) orElse
updateNextPaymentTime orElse
confirmPayments orElse
rejectPayments orElse
rejectTransaction orElse
retryPayments orElse
updateAccount orElse
registerAccount


// If there are payments due, find and pay them
def processPayments(nextKnownPaymentDate: Option[ZonedDateTime]): PartialFunction[Any, Unit] =
case ProcessPayments if nextKnownPaymentDate.exists(_.isBefore(ZonedDateTime.now())) =>
val readyAccounts = accountCache.readyCount
if (readyAccounts > 0)
val payments = repo.due(readyAccounts * 100)
if (payments.isEmpty)
logger.debug("No more payments due.")
context.become(state(repo.earliestTimeDue))
else
val submittingPaymentsWithAccounts: Seq[(Seq[Payment], Account)] =
payments.grouped(100).flatMap(ps => accountCache.borrowAccount.map(ps -> _)).toSeq
val submittingPayments: Seq[Payment] = submittingPaymentsWithAccounts.flatMap(_._1)
repo.submit(submittingPayments.flatMap(_.id), ZonedDateTime.now)

Source.fromIterator(() => submittingPaymentsWithAccounts.iterator).to(paymentSink).run()
println("post source run")





The spec. (sampleOf just creates a random instance and is not pertinent to the problem).



 "the payment sink" should 
"submit to the network" in
val (network, conf, repo, cache) = setup
val account = sampleOf(genAccount)
val payments = sampleOf(Gen.listOfN(3, genPayment))
when(repo.earliestTimeDue).thenReturn(Some(ZonedDateTime.now()))
when(repo.due(100)).thenReturn(payments)

val actor = system.actorOf(Props(new PaymentProcessorActor(repo, cache, conf)))

// these two calls set up the actor state so that payments will be processed
actor ! UpdateNextPaymentTime
actor ! UpdateAccount(account)

// this invokes the stream under test
actor ! ProcessPayments

eventually(timeout(5 seconds))
assert(network.posted.size == 1)




private def setup: (StubNetwork, AppConfig, PaymentRepo, AccountCache) =
val n = StubNetwork()
val conf = new AppConfig
val network: Network = n
val accounts: Map[String, KeyPair] = Map.empty

val repo = mock[PaymentRepo]
(n, conf, repo, new AccountCache)



At runtime, I see the stdout messages:



post source run
inside flow


But during test I only see



post source run


With debugging, I see that all values are correct and the source .run is called. But somehow it does not run.










share|improve this question
















I have an actor that invokes a stream. At runtime this works as intended, but when tested the stream is not invoked.



The Actor (abbreviated)



class PaymentProcessorActor(repo: PaymentRepo, accountCache: AccountCache, config: AppConfig) extends Actor {

implicit private val materializer: ActorMaterializer = ActorMaterializer()
implicit private val network: Network = config.network
private implicit val ec: ExecutionContextExecutor = context.dispatcher

val paymentSink: Sink[(Seq[Payment], Account), NotUsed] =
Flow[(Seq[Payment], Account)].map case (ps, account) =>
println("inside flow")
// ... block of type Future[(TransactionResponse, Seq[Payment], Account)] here

.mapAsync(parallelism = config.accounts.size)(_.map
case ((_: TransactionApproved, ps), account) =>
// handle approval

case ((x: TransactionRejected, ps), account) =>
// handle rejection
)
.to(Sink.ignore)

override def receive: Receive = state(nextKnownPaymentDate = None)

private def state(nextKnownPaymentDate: Option[ZonedDateTime]): Receive =
processPayments(nextKnownPaymentDate) orElse
updateNextPaymentTime orElse
confirmPayments orElse
rejectPayments orElse
rejectTransaction orElse
retryPayments orElse
updateAccount orElse
registerAccount


// If there are payments due, find and pay them
def processPayments(nextKnownPaymentDate: Option[ZonedDateTime]): PartialFunction[Any, Unit] =
case ProcessPayments if nextKnownPaymentDate.exists(_.isBefore(ZonedDateTime.now())) =>
val readyAccounts = accountCache.readyCount
if (readyAccounts > 0)
val payments = repo.due(readyAccounts * 100)
if (payments.isEmpty)
logger.debug("No more payments due.")
context.become(state(repo.earliestTimeDue))
else
val submittingPaymentsWithAccounts: Seq[(Seq[Payment], Account)] =
payments.grouped(100).flatMap(ps => accountCache.borrowAccount.map(ps -> _)).toSeq
val submittingPayments: Seq[Payment] = submittingPaymentsWithAccounts.flatMap(_._1)
repo.submit(submittingPayments.flatMap(_.id), ZonedDateTime.now)

Source.fromIterator(() => submittingPaymentsWithAccounts.iterator).to(paymentSink).run()
println("post source run")





The spec. (sampleOf just creates a random instance and is not pertinent to the problem).



 "the payment sink" should 
"submit to the network" in
val (network, conf, repo, cache) = setup
val account = sampleOf(genAccount)
val payments = sampleOf(Gen.listOfN(3, genPayment))
when(repo.earliestTimeDue).thenReturn(Some(ZonedDateTime.now()))
when(repo.due(100)).thenReturn(payments)

val actor = system.actorOf(Props(new PaymentProcessorActor(repo, cache, conf)))

// these two calls set up the actor state so that payments will be processed
actor ! UpdateNextPaymentTime
actor ! UpdateAccount(account)

// this invokes the stream under test
actor ! ProcessPayments

eventually(timeout(5 seconds))
assert(network.posted.size == 1)




private def setup: (StubNetwork, AppConfig, PaymentRepo, AccountCache) =
val n = StubNetwork()
val conf = new AppConfig
val network: Network = n
val accounts: Map[String, KeyPair] = Map.empty

val repo = mock[PaymentRepo]
(n, conf, repo, new AccountCache)



At runtime, I see the stdout messages:



post source run
inside flow


But during test I only see



post source run


With debugging, I see that all values are correct and the source .run is called. But somehow it does not run.







scala akka scalatest akka-stream






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 2:45







Synesso

















asked Mar 8 at 22:19









SynessoSynesso

20.7k27109170




20.7k27109170












  • Not directly related to your question, but at "inside flow" why would you create a Future in a map rather than doing a mapAsync here? I sort of suspect there's blocking on the dispatcher somewhere, but don't see it here directly.

    – Arnout Engelen
    Mar 9 at 8:40












  • Thanks for your comment @ArnoutEngelen. I call out to a library function which returns a Future. The full block being github.com/0rora/0rora/blob/ba373e/app/models/… Does that look problematic?

    – Synesso
    Mar 11 at 4:51

















  • Not directly related to your question, but at "inside flow" why would you create a Future in a map rather than doing a mapAsync here? I sort of suspect there's blocking on the dispatcher somewhere, but don't see it here directly.

    – Arnout Engelen
    Mar 9 at 8:40












  • Thanks for your comment @ArnoutEngelen. I call out to a library function which returns a Future. The full block being github.com/0rora/0rora/blob/ba373e/app/models/… Does that look problematic?

    – Synesso
    Mar 11 at 4:51
















Not directly related to your question, but at "inside flow" why would you create a Future in a map rather than doing a mapAsync here? I sort of suspect there's blocking on the dispatcher somewhere, but don't see it here directly.

– Arnout Engelen
Mar 9 at 8:40






Not directly related to your question, but at "inside flow" why would you create a Future in a map rather than doing a mapAsync here? I sort of suspect there's blocking on the dispatcher somewhere, but don't see it here directly.

– Arnout Engelen
Mar 9 at 8:40














Thanks for your comment @ArnoutEngelen. I call out to a library function which returns a Future. The full block being github.com/0rora/0rora/blob/ba373e/app/models/… Does that look problematic?

– Synesso
Mar 11 at 4:51





Thanks for your comment @ArnoutEngelen. I call out to a library function which returns a Future. The full block being github.com/0rora/0rora/blob/ba373e/app/models/… Does that look problematic?

– Synesso
Mar 11 at 4:51












1 Answer
1






active

oldest

votes


















0














In the line .mapAsync(parallelism = config.accounts.size), the value was zero, which is an error condition. The Flow never initialised. This failure does not propagate to the main thread.



Additionally, I had turned off Akka logging for tests in the configuration, so this failure was not logged.






share|improve this answer


















  • 1





    Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

    – Explorer
    Mar 12 at 20:35











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071791%2fsink-inside-actor-invoked-during-prod-but-not-during-test%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














In the line .mapAsync(parallelism = config.accounts.size), the value was zero, which is an error condition. The Flow never initialised. This failure does not propagate to the main thread.



Additionally, I had turned off Akka logging for tests in the configuration, so this failure was not logged.






share|improve this answer


















  • 1





    Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

    – Explorer
    Mar 12 at 20:35















0














In the line .mapAsync(parallelism = config.accounts.size), the value was zero, which is an error condition. The Flow never initialised. This failure does not propagate to the main thread.



Additionally, I had turned off Akka logging for tests in the configuration, so this failure was not logged.






share|improve this answer


















  • 1





    Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

    – Explorer
    Mar 12 at 20:35













0












0








0







In the line .mapAsync(parallelism = config.accounts.size), the value was zero, which is an error condition. The Flow never initialised. This failure does not propagate to the main thread.



Additionally, I had turned off Akka logging for tests in the configuration, so this failure was not logged.






share|improve this answer













In the line .mapAsync(parallelism = config.accounts.size), the value was zero, which is an error condition. The Flow never initialised. This failure does not propagate to the main thread.



Additionally, I had turned off Akka logging for tests in the configuration, so this failure was not logged.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 11 at 5:24









SynessoSynesso

20.7k27109170




20.7k27109170







  • 1





    Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

    – Explorer
    Mar 12 at 20:35












  • 1





    Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

    – Explorer
    Mar 12 at 20:35







1




1





Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

– Explorer
Mar 12 at 20:35





Just add a supervision strategy while creating a materializer to log the errors, like: ActorMaterializerSettings(actorSystem).withSupervisionStrategy(decider) and decider will be: decider: Supervision.Decider = case ex: Exception => ` logger.error(s"Unhandled exception in stream: $ex")` Supervision.Stop ` `

– Explorer
Mar 12 at 20:35



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071791%2fsink-inside-actor-invoked-during-prod-but-not-during-test%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved