This is not a 24h/7d support channel, wait a bit ;-)
Thanks.

-- 
Cheers,
Konrad 'ktoso <http://kto.so>' Malawski
Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>

On February 23, 2018 at 17:34:30, Kanwaljeet Singh (ksachd...@gmail.com)
wrote:

Any pointers Konrad?

On Thu, Feb 22, 2018, 11:59 PM Kanwaljeet Singh <ksachd...@gmail.com> wrote:

> In my current code u feel that it is cyclic dependency because you see
> actor1 having access to failedService bean and actor2. But in reality, I
> can just remove actor2 being injected into actor1 if I can get away by
> using failedservice bean. Even if I do that, things remain the same. I have
> my Actor1 as below now(and I think no cyclic depenency now). I still hit
> the issue
>
> class Actor1(failedService: FailedService) extends Actor{
>
>
>   override def receive: Receive = {
>     case TriggerActor1() =>
>       println("Actor1 triggered from REST controller. Send msg to actor 2")
>       failedService.testSend()
>       //actor2 ! Msg1()
>     case Msg2() => println("got msg2 from actor 1")
>   }
>
>
> On Thu, Feb 22, 2018 at 11:57 PM Konrad “ktoso” Malawski <
> konrad.malaw...@lightbend.com> wrote:
>
>> It is a macwire thing ;-)
>> It hides you made a cyclic dependency.
>>
>> how would you make this work, plain java/scala:
>>
>> val a = new A(requires B!)
>> val b = new B(a /*requires A*/)
>> Hm, A has an issue...
>>
>> val b = new B(requires B)
>> val a = new A(b /*requires B!*/)
>> Hmm, B can’t get A…
>>
>> As simple as that.
>> Don’t do cyclic dependencies like that.
>>
>> you can create both and do a `a ! HelloIAm(b)` or something similar.
>>
>> --
>> Cheers,
>> Konrad 'ktoso <http://kto.so>' Malawski
>> Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>
>>
>> On February 23, 2018 at 16:51:48, Kanwaljeet Singh (ksachd...@gmail.com)
>> wrote:
>>
>> here is my code
>>
>> class Actor1(failedService: FailedService, actor2: ActorRef @@ Actor2) 
>> extends Actor{
>>   override def receive: Receive = {
>>     case TriggerActor1() =>
>>       println("Actor1 triggered from REST controller. Send msg to actor 2")
>>       failedService.testSend()
>>       //actor2 ! Msg1()
>>     case Msg2() => println("got msg2 from actor 1")
>>   }
>>
>>
>>
>> class Actor2 extends Actor {
>>   override def receive: Receive = {
>>     case Msg1() => {
>>       println("send without future")
>>       val origsender = sender()
>>       origsender ! Msg2()
>>     }
>>   }
>>
>>
>> class FailedService(actor2: ActorRef@@Actor2) {
>>   def testSend() = {
>>     actor2 ! Msg1()
>>   }
>> }
>>
>>
>> With my current code as shared above, Actor1 is able to send Msg1 to Actor2
>>
>> and actor2 responds with Msg2 but Msg2 goes to deadletter. I get the below 
>> error
>>
>> akka.actor.DeadLetterActorRef - Message [backup.failedakka.Msg2] from 
>> Actor[akka://application/user/actor2#-662746578] to 
>> Actor[akka://application/deadLetters] was not delivered. [1] dead letters 
>> encountered.
>>
>>
>> However, if insted of using the line "failedService.testSend()" in my 
>> Actor1, I uncomment the line below it
>>
>> and use that to communicate, things work fine.
>>
>> Is the Q clear now? I am injecting dependencies with MacWire
>>
>> On Thu, Feb 22, 2018 at 11:07 PM Kanwaljeet Singh <ksachd...@gmail.com>
>> wrote:
>>
>>> this is nto a macwire question I think.
>>>
>>> On Thu, Feb 22, 2018 at 11:06 PM Konrad “ktoso” Malawski <
>>> konrad.malaw...@lightbend.com> wrote:
>>>
>>>> I don’t understand what’s going where or how ;-)
>>>> Could you share code?
>>>>
>>>> Also, isn’t this a macwire question? Better to ask on
>>>> https://github.com/adamw/macwire/issues ?
>>>>
>>>> --
>>>> Cheers,
>>>> Konrad 'ktoso <http://kto.so>' Malawski
>>>> Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>
>>>>
>>>> On February 23, 2018 at 16:05:22, ksachd...@gmail.com (
>>>> ksachd...@gmail.com) wrote:
>>>>
>>>>
>>>>    1.
>>>>
>>>>    Scenario 1 - Working scenario
>>>>    - Actor1 -->MyMsg1-->Actor2
>>>>       - Actor2 MyMsgHandler - Processes message(with Future), does
>>>>       pipeTo to sender with MyMsg2. Works fine, Actor1 recvs MyMsg2
>>>>
>>>>
>>>>
>>>>    1.
>>>>
>>>>    Scenario2 - Failing scenario
>>>>    - Actor1 has a bean injected via MacWire - myBean.
>>>>       - myBean has Actor2 injected as a bean and sends MyMsg1 to Actor2
>>>>       - Actor2 MyMsgHandler processes message(with Future), does
>>>>       pipeTo to sender and tries sending MyMsg2 - Goes to deadLetter.
>>>>       The actor Ref for sender is never set.
>>>>
>>>> How do I fix scenario2?
>>>>
>>>> --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ:
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives:
>>>> https://groups.google.com/group/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to akka-user+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to