[akka-user] beginner question on akka streams flow design.

2017-06-02 Thread Mohnish Kodnani
Hi , 
I have the following use case that I want to model using akka streams and I 
am new to akka streams so would like to know how/what is the best way to 
model it. 

I have a kafka consumer which reads from one topic massages the message and 
sends it to a RESTful external service. 
This external restful service takes a token that needs to be sent with 
every message in the header. This token expires every roughly 24 hours.

I was thinking of creating an FSM actor that will act as a Token Manager. 
It will be in Active state where it can send the current token on receiving 
say a GetToken message. Then every 24 hours it receives a scheduled event 
for FetchToken, then it will go into Fetching mode, where it will retrieve 
a new token from another service and in that state it should keep queuing 
the requests for GetToken.

Now, how do i hook this actor (TokenManager) into my stream so that it can 
provide a token for every message from kafka but block the stream until it 
gets a new token when it expires. 
Or if there is another solution to what I am thinking instead of creating a 
separate actor. 

Thanks
Mohnish.


-- 
>>  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.


[akka-user] spray cache and akka http

2016-06-01 Thread Mohnish Kodnani
Hi, 
We have a project where we need to talk to hadoop/hdfs to download some 
files from it. This requires that we have protobuf 2.5.0. This is a new 
cluster for us and before this the older hadoop version was using protobuf 
2.4.0
We were using spray 1.3 and akka 2.3 and things were working fine. But now 
the same service is failing due to incompatible protobuf dependencies. 
I tried to upgrade our project to akka 2.4.6 because I read that akka 2.4.x 
allows clients to specify their own protobuf version. 
However, our service was using spray cache on top of the routes and I have 
not seen any example of caching directives in akka http and if I include 
spray cache dependency along with akka-http it doesnt go well, because the 
cache directive expect spray.routing.RequestContext => Unit, while the 
internal route that we have is akka.http.scaladsl.server.RequestContext => 
akka.http.scaladsl.RouteResult

Is spray cache migrating to akka-http ?


Thanks
Mohnish

-- 
>>  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.


Re: [akka-user] [play 2.2.1] A Akka FSM state transition is not firing onTransition to the same state. Is this expected behaviour?

2014-09-24 Thread Mohnish Kodnani
To be more specific , will this change be available in 2.3.x codeline.


On Wednesday, September 24, 2014 1:23:31 PM UTC-7, Mohnish Kodnani wrote:
>
> Has this been released ?
>
>
> On Tuesday, April 1, 2014 12:27:36 PM UTC-7, Tyler C wrote:
>>
>> Awesome, thanks for the positive responses!
>>
>> Just for the benefit of providing breadcrumbs, here's the ticket I 
>> created on Patrik's advice (you've probably seen it already). 
>> https://www.assembla.com/spaces/akka/tickets/3970
>>
>> Tyler
>>
>>
>> On Tuesday, April 1, 2014 12:18:22 PM UTC-7, rkuhn wrote:
>>>
>>> Hi Tyler,
>>>
>>> 29 mar 2014 kl. 19:35 skrev Tyler C :
>>>
>>> I just experienced this issue myself. It seems to me that there could be 
>>> value in allowing the implementer of the FSM to decide which transitions 
>>> are valuable and which are not. Akka does provide the distinction between 
>>> goto(state) and stay() -- couldn't the first imply a transition where the 
>>> second does not? Back in my college automata course, we implemented plenty 
>>> of state machines with same-state transitions that were significant 
>>> (consuming messages in the process): regular expressions like */(a)*b/* 
>>> being a perfect example.
>>>
>>> My work-around has been to implement two identical states that simply 
>>> bounce between each other. While workable it looks quite clumsy, as in this 
>>> FizzBuzz example: https://gist.github.com/JavadocMD/9859519
>>>
>>> Is there any chance the Akka team could reconsider this implementation 
>>> or are there compelling reasons to leave it as-is?
>>>
>>>
>>> The reason was mostly that the FSM did what I needed at the time ;-) 
>>> What you propose makes sense, especially using goto(sameState) (which 
>>> should currently be unused) would be a good way to encode this.
>>>
>>> Regards,
>>>
>>> Roland
>>>
>>>
>>> Thanks,
>>> Tyler
>>>
>>>
>>> On Monday, March 17, 2014 2:09:50 PM UTC-7, Patrik Nordwall wrote:
>>>>
>>>> Hi,
>>>>
>>>>
>>>> On Mon, Mar 17, 2014 at 5:43 PM, brett  wrote:
>>>>
>>>>> Hi 
>>>>>
>>>>> I have a finite state machine modelled in Akka FSM that in certain 
>>>>> circumstance transitions back to the same state after updating some 
>>>>> values.
>>>>>
>>>>> I have found that the onTransition handler is called when i transition 
>>>>> from one different state to another (e.g. A to B)  but this handler is 
>>>>> not 
>>>>> called when I transition from the same state (e.g. A to A).
>>>>>
>>>>> Is this expected behaviour of the Akka FSM?
>>>>>
>>>>
>>>> Yes, that is expected. Staying in the same state is not a state 
>>>> transition.
>>>> Cheers,
>>>> Patrik
>>>>  
>>>>
>>>>>
>>>>> cheers
>>>>>
>>>>> Brett 
>>>>>
>>>>> p.s. I originally posted this question over on the play framework user 
>>>>> list but i have been advised to post it here so apologise to those of you 
>>>>> who see this question twice in your inbox.
>>>>>
>>>>> -- 
>>>>> >>>>>>>>>> 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+...@googlegroups.com.
>>>>> To post to this group, send email to akka...@googlegroups.com.
>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>>
>>>> Patrik Nordwall
>>>> Typesafe <http://typesafe.com/> - 

Re: [akka-user] [play 2.2.1] A Akka FSM state transition is not firing onTransition to the same state. Is this expected behaviour?

2014-09-24 Thread Mohnish Kodnani
Has this been released ?


On Tuesday, April 1, 2014 12:27:36 PM UTC-7, Tyler C wrote:
>
> Awesome, thanks for the positive responses!
>
> Just for the benefit of providing breadcrumbs, here's the ticket I created 
> on Patrik's advice (you've probably seen it already). 
> https://www.assembla.com/spaces/akka/tickets/3970
>
> Tyler
>
>
> On Tuesday, April 1, 2014 12:18:22 PM UTC-7, rkuhn wrote:
>>
>> Hi Tyler,
>>
>> 29 mar 2014 kl. 19:35 skrev Tyler C :
>>
>> I just experienced this issue myself. It seems to me that there could be 
>> value in allowing the implementer of the FSM to decide which transitions 
>> are valuable and which are not. Akka does provide the distinction between 
>> goto(state) and stay() -- couldn't the first imply a transition where the 
>> second does not? Back in my college automata course, we implemented plenty 
>> of state machines with same-state transitions that were significant 
>> (consuming messages in the process): regular expressions like */(a)*b/* 
>> being a perfect example.
>>
>> My work-around has been to implement two identical states that simply 
>> bounce between each other. While workable it looks quite clumsy, as in this 
>> FizzBuzz example: https://gist.github.com/JavadocMD/9859519
>>
>> Is there any chance the Akka team could reconsider this implementation or 
>> are there compelling reasons to leave it as-is?
>>
>>
>> The reason was mostly that the FSM did what I needed at the time ;-) What 
>> you propose makes sense, especially using goto(sameState) (which should 
>> currently be unused) would be a good way to encode this.
>>
>> Regards,
>>
>> Roland
>>
>>
>> Thanks,
>> Tyler
>>
>>
>> On Monday, March 17, 2014 2:09:50 PM UTC-7, Patrik Nordwall wrote:
>>>
>>> Hi,
>>>
>>>
>>> On Mon, Mar 17, 2014 at 5:43 PM, brett  wrote:
>>>
 Hi 

 I have a finite state machine modelled in Akka FSM that in certain 
 circumstance transitions back to the same state after updating some values.

 I have found that the onTransition handler is called when i transition 
 from one different state to another (e.g. A to B)  but this handler is not 
 called when I transition from the same state (e.g. A to A).

 Is this expected behaviour of the Akka FSM?

>>>
>>> Yes, that is expected. Staying in the same state is not a state 
>>> transition.
>>> Cheers,
>>> Patrik
>>>  
>>>

 cheers

 Brett 

 p.s. I originally posted this question over on the play framework user 
 list but i have been advised to post it here so apologise to those of you 
 who see this question twice in your inbox.

 -- 
 >> 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+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>>
>>> Patrik Nordwall
>>> Typesafe  -  Reactive apps on the JVM
>>> Twitter: @patriknw
>>>
>>>  
>> -- 
>> >> 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+...@googlegroups.com.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> *Dr. Roland Kuhn*
>> *Akka Tech Lead*
>> Typesafe  – Reactive apps on the JVM.
>> twitter: @rolandkuhn
>> 
>>  
>>

-- 
>>  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] does classpath order matter when running akka application

2014-08-01 Thread Mohnish Kodnani
Hi, 
I am using gradle to build an akka application. 
All the dependencies are in the lib folder. There is a startup script which 
lies in the bin folder. 
I am using akka-clustering which internally depends on akka-remote which 
depends on netty. 
When I run the application I get the following error. 
java.lang.NoSuchMethodError: 
org.jboss.netty.channel.socket.nio.NioWorkerPool.(Ljava/util/concurrent/Executor;I)V
at 
akka.remote.transport.netty.NettyTransport.(NettyTransport.scala:283)
at 
akka.remote.transport.netty.NettyTransport.(NettyTransport.scala:240)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at 
akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$2.apply(DynamicAccess.scala:78)
at scala.util.Try$.apply(Try.scala:161)
at 
akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:73)


Now, when I put netty-3.8.0.Final.jar before the akka-remote jar in the 
classpath this error goes away. 

Does the ordering of jars matter in the classpath  ?

akka-actor version 2.3.2, akka-cluster : 2.3.3

-Mohnish

-- 
>>  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.