[akka-user] Can typesafe/config can do command line parsing?

2017-05-18 Thread kant kodali
Hi All,

I really like typsafe config library but it looks like it doesn't do any 
command line parsing and create --help docs and so on similar to Apache 
commons CLI however the dependencies are too big for Apache commons CLI. 
wondering if there are any typesafe  libraries that can do CLI parsing?

Thanks!

-- 
>>  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] question on Akka concurrency and ForkJoinPool

2017-04-03 Thread kant kodali
Hi All,

I came across this paper 
 and 
I quoting the paragraph below where I have the question. The author seems 
to suggest JVM threads are different from the threads used by Akka kernel ? 
I am not sure what is the difference? In Java, every thread one may spawn 
is indeed a kernel thread right? I am assuming forkJoinPool also would 
extend the Java Thread class. If so, what really is the difference? and 
what really is a JVM thread (AFAIK a JVM thread is indeed a kernel thread 
right. isn't it? )


"Concurrency in Akka is built using real threads in the lowest layer called 
kernel. Akka’s kernel does all of the fine-grain resource management and 
execution of actors. This causes some unpredictability to occur in the 
execution order and performance. Different JVM configuration, state and 
uptime may cause fluctuations in the performance of Akka-related 
components, some actors that are written serially in the code may be run in 
arbitrary order. The regular JVM threads are still available to use in the 
actors, however that is not advised because it breaks the independence 
principles of Akka components. Also the scaling properties suffer when 
threads are used inside actors because it makes harder to scale (mainly) 
horizontally and also when that specific actor happens to be replicated in 
big numbers"

Thanks!

-- 
>>  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] Can Akka Actors be considered as green threads?

2017-03-31 Thread kant kodali
Got it! Thanks a lot!

On Friday, March 31, 2017 at 3:56:08 AM UTC-7, Konrad Malawski wrote:
>
>
> Actors are objects that are scheduled on Kernel threads using ForkJoin 
> Pool?
>
> That's how they're implemented yeah - tasks submitted to a pool.
>
> But that misses all the things which make the model useful: isolation and 
> location transparency (the most important one!).
>
> So you don't care if an actor is on the same node or not, API does not 
> change, and "fits" as it's messaging and not RPC style which hides the fact 
> that things are remote.
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
>
> On 31 March 2017 at 12:53:32, kant kodali (kant...@gmail.com ) 
> wrote:
>

-- 
>>>>>>>>>>  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] Can Akka Actors be considered as green threads?

2017-03-31 Thread kant kodali
Hi All,

I wonder what is an Actor underneath ? I mean I understand that they are 
Object that have a state, mailbox , listeners and all that but the moment I 
hear Actors can "crash" and "restart and run or process again" I think of 
it as some scheduling/processing entity and I wonder if that entity is a 
green thread that are eventually mapped to Kernel threads like the M:N 
model? 

The statement below says Actors "conceptually" have their own light weight 
thread. what does "conceptually" mean here? If they are not green threads 
can we simply say Actors are objects that are scheduled on Kernel threads 
using ForkJoin Pool?

http://doc.akka.io/docs/akka/current/general/actors.html "Akka actors 
conceptually each have their own light-weight thread"

Thanks!



-- 
>>  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] Can we use activator for Spark projects?

2017-03-27 Thread kant kodali
Hi,

I don't mean to say that I want to use activator for the UI part. In fact,
I barely even use activator ui (although its really cool). I am at very
least using activator as a production build tool for apps that are written
using Play framework. is that ok? I like fact that activator makes the
packaging so easy either it is a zip, rpm debian or whatever and it puts
the configs at the appropriates places and so on.

I know that you mentioned activator is going to go away. How about SBT? is
that there to stay?

Thanks!

On Mon, Mar 27, 2017 at 3:48 AM, Konrad Malawski <
konrad.malaw...@lightbend.com> wrote:

> Activator is just a sample-app tool to try out Scala and tutorials etc.
> I guess it could maybe work with Spark for a demo but I would not
> recommend it...
>
> Use a real IDE :)
>
> --
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 27 March 2017 at 12:46:17, kant kodali (kanth...@gmail.com) wrote:
>
> Hi All,
>
> Can we use activator for Spark projects along with typesafe config
> library? Any examples?
>
> Thanks!
>
> --
> >>>>>>>>>> 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.


[akka-user] Can we use activator for Spark projects?

2017-03-27 Thread kant kodali
Hi All,

Can we use activator for Spark projects along with typesafe config library? 
Any examples?

Thanks!

-- 
>>  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] Does Event Bus require Publisher and Subscriber to be started in certain order?

2017-03-23 Thread kant kodali
Hi All,

Does Event Bus require Publisher and Subscriber to be started in certain 
order? Isn't there a Listener which will push messages to subscribers 
whenever they become alive? 

I am playing with the LookUpBus Example from here 
 but it doesn't 
quite work for me.  here is my sample code and I had also commented on the 
respective lines.

For now, I am just using print statements to debug. since the messages are 
getting printed out I wonder if Publisher and Subscriber to be started in 
certain order?

Thanks!


public class EventBusManager {

private static final LookupBusImpl LOOKUP_BUS = new LookupBusImpl();

public static LookupBusImpl getEventBus() {
return LOOKUP_BUS;
}
}


public class UserActor extends UntypedActor {

private final ActorRef out;
private final String topic;

public UserActor(ActorRef out, String topic) {
this.out = out;
this.topic = topic;
}

public static Props props(ActorRef out, String topic) {
return Props.create(UserActor.class, out, topic);
}

public void preStart() {
EventBusManager.getEventBus().subscribe(self(), topic); // This Actor 
will become the subscriber of even bus so whenever publisher sends a message I

// Expect This 
Actor to receive the messages 

} 

public void postStop() {
EventBusManager.getEventBus().unsubscribe(self());
}

public void onReceive(Object message) throws Exception {

System.out.println("Received Message: " + message); // I expect the 
messages to be printed here
if (message instanceof String) {
out.tell(message, self());
}
}


}



public class LookupBusImpl extends LookupEventBus {

// is used for extracting the classifier from the incoming events
@Override
public String classify(MsgEnvelope event) {
return event.topic;
}

// will be invoked for each event for all subscribers which registered 
themselves
// for the event’s classifier
@Override
public void publish(MsgEnvelope event, ActorRef subscriber) {
System.out.println("LOOKUP_BUS_IMPL: " + event.payload);
subscriber.tell(event.payload, ActorRef.noSender()); // not sure what 
exactly is going on here? But I Expect the above actor to receive the messages
}

// must define a full order over the subscribers, expressed as expected from
// `java.lang.Comparable.compare`
@Override
public int compareSubscribers(ActorRef a, ActorRef b) {
return a.compareTo(b);
}

// determines the initial size of the index data structure
// used internally (i.e. the expected number of different classifiers)
@Override
public int mapSize() {
return 128;
}



}


public class Application extends Controller {

public WebSocket handleWebSocketConnection() {
return WebSocket.withActor(new F.Function() {
@Override
public Props apply(ActorRef actorRef) throws Throwable {
return UserActor.props(actorRef, "hello");
}
});
}

}

public class Global extends GlobalSettings {


@Override
public void onStart(Application application) { 

Logger.info("Brodcasted to event Bus started.."); // This prints out to 
console fine 

EventBusManager.getEventBus().publish(new MsgEnvelope("hello", "Hello 
World")); // This is where I am publishing messages to event bus.
Logger.info("Brodcasted to event Bus completed"); // This prints out to 
console fine 

}


}

-- 
>>  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] Cannot use a method returning play.mvc.WebSocket[?0] as a Handler for requests

2017-03-23 Thread kant kodali
Hi All,

I originally posted this question on SO and tried it myself but unable to 
find what I am  doing wrong? I get the following error. I followed this 
documentation https://www.playframework.com/documentation/2.5.x/JavaWebSockets.


[error] /Users/hello/Documents/java/test_app/conf/routes:8: Cannot use a 
method returning play.mvc.WebSocket[?0] as a Handler for requests

[error] GET /txstatus   
controllers.Application.handleWebSocketConnection()

[error] /Users/hello/Documents/java/test_app/conf/routes:8: not enough 
arguments for method createInvoker: (implicit hif: 
play.core.routing.HandlerInvokerFactory[play.mvc.WebSocket[?0]])play.core.routing.HandlerInvoker[play.mvc.WebSocket[?0]].

[error] two errors found

[error] (compile:compile) Compilation failed




*Here is the problem Description:* 




GET/statuscontrollers.Application.handleWebSocketConnection()

Here is the relevant source code.

public WebSocket handleWebSocketConnection() {
return WebSocket.withActor(new F.Function() {
@Override
public Props apply(ActorRef actorRef) throws Throwable {
return UserActor.props(actorRef, "");
}
});}

here is my build.sbt

import play.routes.compiler.InjectedRoutesGeneratorimport play.sbt.PlayScala

name := "hello"

version := "1.0"

lazy val `dashboard` = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  jdbc ,
  cache ,
  ws   ,
  specs2 % Test,
  "io.netty" % "netty-all" % "4.0.0")

unmanagedResourceDirectories in Test <+=  baseDirectory ( _ 
/"target/web/public/test" )  

resolvers ++= Seq(
  "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases;)

routesGenerator := InjectedRoutesGenerator

fork in run := true

I am using Play version 2.4.2 and all the source code is in java 8. I get 
the following error

Cannot use a method returning play.mvc.WebSocket[?0] as a Handler for requests

any ideas?

Thanks!

-- 
>>  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] Does Activator require SBT ? Can it work with gradle?

2017-03-22 Thread kant kodali
Any rough timeline?

On Wednesday, March 22, 2017 at 4:58:53 AM UTC-7, Konrad Malawski wrote:
>
> As I just mentioned, we're working on it, there will be a replacement ;)
>
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 22 March 2017 at 13:46:46, kant kodali (kant...@gmail.com ) 
> wrote:
>
> oh if you guys are deprecating activator what is its replacement? Any 
> pointer on the web I can follow?
>
> On Wednesday, March 22, 2017 at 4:32:35 AM UTC-7, Konrad Malawski wrote: 
>>
>> Thanks!
>>
>> It does require it. It is only a getting started tool so you should not 
>> really care. Your normal development you do in whichever thing you want.
>> It is also being deprecated in favour of new tools we're working on at 
>> Lightbend.
>>
>> -- 
>> Konrad `ktoso` Malawski
>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>
>> On 22 March 2017 at 13:31:15, kant kodali (kant...@gmail.com) wrote:
>>
>> Hi All, 
>>
>> I love the activator tool. Whoever implemented a big thanks! I am 
>> wondering if it require SBT ? can it work with gradle (since we currently 
>> use gradle)?
>>
>> Thanks!
>> --
>> >>>>>>>>>> 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 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+...@googlegroups.com .
> To post to this group, send email to akka...@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.


Re: [akka-user] Does Activator require SBT ? Can it work with gradle?

2017-03-22 Thread kant kodali
oh if you guys are deprecating activator what is its replacement? Any 
pointer on the web I can follow?

On Wednesday, March 22, 2017 at 4:32:35 AM UTC-7, Konrad Malawski wrote:
>
> Thanks!
>
> It does require it. It is only a getting started tool so you should not 
> really care. Your normal development you do in whichever thing you want.
> It is also being deprecated in favour of new tools we're working on at 
> Lightbend.
>
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 22 March 2017 at 13:31:15, kant kodali (kant...@gmail.com ) 
> wrote:
>
> Hi All, 
>
> I love the activator tool. Whoever implemented a big thanks! I am 
> wondering if it require SBT ? can it work with gradle (since we currently 
> use gradle)?
>
> Thanks!
> --
> >>>>>>>>>> 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 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.


[akka-user] Does Activator require SBT ? Can it work with gradle?

2017-03-22 Thread kant kodali
Hi All,

I love the activator tool. Whoever implemented a big thanks! I am wondering 
if it require SBT ? can it work with gradle (since we currently use gradle)?

Thanks!

-- 
>>  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] Re: How to group a list of actors in Akka?

2017-03-22 Thread kant kodali
Thanks! I ended up using LookupEventBus and that solved my problem!


On Tuesday, March 21, 2017 at 3:16:52 AM UTC-7, kant kodali wrote:
>
> Hi All,
>
> How to group a list of actors? I want to send message A to group of Actors 
> M and message B to group of Actors N. Is there a way to give them a common 
> name and access them through that name so I can send my messages? or Is 
> there any better way?
>
> Thanks!
>

-- 
>>>>>>>>>>  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] How to group a list of actors in Akka?

2017-03-21 Thread kant kodali
I think I understand it better from what you said. I guess I don't have
separate parent for each group therefore I was looking to see how to group
the child actors but anyways since it is not the standard approach from
what you are saying I would not go that way. I believe I can leverage event
bus <http://doc.akka.io/docs/akka/current/java/event-bus.html> for this
since all I want to do is broadcast different messages to different groups
of actors within a single JVM.

Is it recommended to have multiple actors systems within the same JVM? I am
using the Play framework and it has a default Actor system but I wondering
if I should use Actor system provided by the Play framework or create my
own to leverage event bus?

I am assuming the different between pub-sub and event bus is one is
distributed and other is not respectively. isn't it?

Thanks for your time
kant





On Tue, Mar 21, 2017 at 2:39 PM, Justin du coeur <jduco...@gmail.com> wrote:

> Not sure I understand the desired use case, but I believe the answer is no
> -- the *path* of an Actor has to be unique.  That is, for a given parent,
> only one child may have a given name.
>
> Is there a reason not to just have the parent maintain separate lists of
> the different groups?  You seem to be trying to find a built-in solution to
> a problem that folks usually just solve manually (because it is usually
> extremely easy to do so).
>
> On Tue, Mar 21, 2017 at 4:18 PM, kant kodali <kanth...@gmail.com> wrote:
>
>> Can two actors have the  same name? For Example, Can I create same
>> instance of Actor class in a For loop so I can access all the actors by
>> that name?
>>
>> On Tue, Mar 21, 2017 at 6:12 AM, Justin du coeur <jduco...@gmail.com>
>> wrote:
>>
>>> Right -- that's probably the way I would tend to construct something
>>> like this, but it would depend on the use case, as well as whether the
>>> "groups" in question were mutually exclusive...
>>>
>>> On Tue, Mar 21, 2017 at 9:05 AM, Konrad Malawski <
>>> konrad.malaw...@lightbend.com> wrote:
>>>
>>>>
>>>> As such, no -- there's no formal "group" concept like this, although
>>>> you could construct it manually yourself.
>>>>
>>>> There is "all children of given actor" which is accessible by
>>>> context.children() inside an Actor.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Konrad `ktoso` Malawski
>>>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>>>
>>>>
>>>> On 21 March 2017 at 15:02:26, Justin du coeur (jduco...@gmail.com)
>>>> wrote:
>>>>
>>>
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c
>>> urrent/additional/faq.html
>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou
>>> p/akka-user
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Akka User List" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/akka-user/UAFqhZYk8uc/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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/c
>> urrent/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: htt

Re: [akka-user] How to group a list of actors in Akka?

2017-03-21 Thread kant kodali
Can two actors have the  same name? For Example, Can I create same instance
of Actor class in a For loop so I can access all the actors by that name?

On Tue, Mar 21, 2017 at 6:12 AM, Justin du coeur  wrote:

> Right -- that's probably the way I would tend to construct something like
> this, but it would depend on the use case, as well as whether the "groups"
> in question were mutually exclusive...
>
> On Tue, Mar 21, 2017 at 9:05 AM, Konrad Malawski <
> konrad.malaw...@lightbend.com> wrote:
>
>>
>> As such, no -- there's no formal "group" concept like this, although you
>> could construct it manually yourself.
>>
>> There is "all children of given actor" which is accessible by
>> context.children() inside an Actor.
>>
>>
>>
>>
>> --
>> Konrad `ktoso` Malawski
>> Akka  @ Lightbend 
>>
>>
>> On 21 March 2017 at 15:02:26, Justin du coeur (jduco...@gmail.com) wrote:
>>
>
> --
> >> 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 a topic in the
> Google Groups "Akka User List" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/akka-user/UAFqhZYk8uc/unsubscribe.
> To unsubscribe from this group and all its topics, 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.


[akka-user] How to group a list of actors in Akka?

2017-03-21 Thread kant kodali
Hi All,

How to group a list of actors? I want to send message A to group of Actors 
M and message B to group of Actors N. Is there a way to give them a common 
name and access them through that name so I can send my messages? or Is 
there any better way?

Thanks!

-- 
>>  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] Re: How to listen to events on CassandraJournalProvider ?

2017-03-20 Thread kant kodali
Hi Michael,

Any idea how that that is implemented? I understand this setting
"cassandra-journal.pubsub-minimum-interval" is for
Akka-Cassandra-Persistence but I wonder what exactly it leverages
underneath from Cassandra or Cassandra driver?

Thanks,
kant

On Mon, Mar 13, 2017 at 1:57 AM, 'Michal Borowiecki' via Akka User List <
akka-user@googlegroups.com> wrote:

> Also, there's a setting called "cassandra-journal.pubsub-minimum-interval",
> which if set will cause the journal to notify the persistence query side of
> new writes, so it can only poll when needed instead of doing so
> periodically.
> Cheers,
> Michal
>
> On 12/03/17 19:15, Patrik Nordwall wrote:
>
> Tal describes it very well. In the future we'll hopefully be able to get
> notifications from Cassandra when something has changed instead of using
> the primitive poll approach. There is already Change Data Capture (CDC) in
> Cassandra but it's an extremely low level api so far. Improvement
> suggestions based on CDC or something else very much welcome.
>
> /Patrik
> sön 12 mars 2017 kl. 15:24 skrev Tal Pressman <kir...@gmail.com>:
>
>> Hi,
>>
>> I think the name for Persistence Query is a little misleading - when I
>> first heard it I imagined something like an SQL query that can run over the
>> data source, but that's not what it is. What it actually does is set up an
>> Akka stream source that handles the events from the data store. The stream
>> can be finite (like currentEventsByPersistenceId will stop once it has
>> caught up with all the events) or infinite (like eventsByPersistenceId). In
>> the second case, whenever there a new message is written to the data store
>> (and the stream isn't back-pressured / busy) the source will emit the new
>> message for the stream to handle.
>>
>> Now, as you've mentioned, there is no "push" mechanism for Cassandra, but
>> that doesn't mean that everything breaks down. It simply means that when
>> you use the CassandraReadJournal there is a thread that polls the DB and
>> when there are new events there passes them down the stream.
>>
>> HTH,
>> Tal
>>
>>
>> On Sunday, March 12, 2017 at 4:09:02 PM UTC+2, kant kodali wrote:
>>
>> Hi All,
>>
>> I am trying to understand event sourcing in detail and I am new to Akka.
>> One of book I was reading says a Persistence Actor will write events to a
>> Journal so in my case the Journal is Cassandra and one can have Persistence
>> Query Actor listen to the events from the Journal and this is where I don't
>> understand how it works. More specifically, How does Persistence Query
>> Actor know they are new events that it needs to Query for? I assume
>> Persistence Actor and Persistence Query Actor are two separate things (so
>> How does Persistence Query Actor gets notified that there are new events
>> written by Persistence Actor)
>>
>> I would like to get live stream from Cassandra but I as far as I know I
>> don't think there is any push based mechanism in Cassandra where Cassandra
>> itself will push new events to some message bus or application. please
>> correct me if I am wrong.
>>
>> Thanks,
>> kant
>>
>> --
>> >>>>>>>>>> Read the docs: <http://akka.io/docs/>http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ:
>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
>> 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>
>> 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/>http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives:
> <https://groups.google.com/group/akka-user>https://groups.google.com/
> group/akka-user
> ---
> You received this message because you are subs

[akka-user] How to get all the Actors that are holding a particular web socket endpoint using Play framework?

2017-03-19 Thread kant kodali
Hi All,

I have a message queue which doesn't have Actor concepts or anything so 
what I plan to do is that on the application startup I want to start the 
consumer which will then keep getting messages from the queue. Now, Play 
framework creates an Actor for every Web Socket Connection and I want to be 
able to group all the Actors that hold the Web Socket connection for a 
particular ws endpoint so that I can broadcast all the messages that I 
received from message queue on particular topic to those group of Actors. 

For Example the following end points will have an Actor created every time 
a client initiates a request to any of the end point below. so lets call 
them Foo actors and Bar Actors. 

ws://localshost/foo 

ws://localshost/bar

https://www.playframework.com/documentation/2.5.x/JavaWebSockets

Now all I want to do is this 

Pseudo code:
   
 messages = ReceiveMessagesFromQueue; // This is a live stream and it never 
stops.
 for message in messages:
 if message has key1:
   List foo_list = getAllFooActors
   broadcast(message, foo_list)
 else if message has key2:
   List bar_list = getAllBarActors
   broadcast(message, bar_list)

Please Let me know if you have any suggestions on the best way to approach 
this problem using Play Framework (I am using the latest version).

Thanks!

-- 
>>  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] Re: How akka cluster become network partition

2017-03-17 Thread kant kodali
Why does one needs to take an approach of Split brain resolver when there 
is something better? The problem of network partitions is well understood 
in most distributed nosql databases. For example Cassandra continues to 
operate with the nodes that are available/reachable/up during 
network partitions and when the network partition is resolved (typically by 
fixing the cable or hardware) The most up to date nodes will just stream 
data to the stale ones. 

 


On Thursday, March 16, 2017 at 4:08:07 AM UTC-7, Dai Yinhua wrote:
>
> Hi team,
>
> I am aware that akka cluster may be partitioned to 2 clusters with 
> auto-downing.
> But I can't understand how does it happen?
> If node A is performing a long GC? And then node A become unreachable, 
> after a while, node A is marked as down, why the cluster is partitioned in 
> this case?
>
> Can you help to explain more clearly on that? 
>
> Thank you.
>

-- 
>>  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] Re: Cassandra Time Stamp Problem and How Akka can help?

2017-03-17 Thread kant kodali
Do I need to specify how many nodes or shards I want to distribute to ? 
Node can go up and down right.. Can the Akka cluster discover how many 
nodes are available at any given time? Also, Why should I manually down the 
node? I know that there is a failure detector so if the Akka cluster 
"thinks" a node is dead then why cant it simply distribute that region to 
other actors?

Thanks!


On Thursday, March 16, 2017 at 9:46:10 AM UTC-7, Justin du coeur wrote:
>
> Look at it this way -- typically, you're generating events about some 
> *thing*, which corresponds to the key you're using in Cassandra.  That's 
> the "entity" I'm talking about, and typically it would have a single Actor 
> in Akka, to which all events are being sent.  That Actor mediates all the 
> Cassandra reads and writes about that entity without thread contention, so 
> you don't have to worry about race conditions.  If the entity isn't being 
> used continually, you can allow it to passivate (go to sleep and stop using 
> memory) after a timeout, and have it automatically revive (based on the 
> event history) when it is next needed.
>
> And yes, Akka Cluster Sharding is smart about dealing with it when the 
> node dies -- so long as you "down" the node (telling Akka that yes, this 
> node is considered dead), it will move the shard to another node as 
> necessary.  It's a pretty mature system for dealing with this sort of stuff.
>
> I don't have a straightforward example myself (my system uses all of this, 
> but is fairly complex) -- anybody else have a good example to point to?
>
> On Wed, Mar 15, 2017 at 7:29 PM, kant kodali <kant...@gmail.com 
> > wrote:
>
>> What is each Entity if I may ask? By Entity you mean Actor? If I shard 
>> messages across group of actors or actor systems through some user 
>> specified function and say an actor or actor system(a node) dies then Does 
>> Akka redirect that shard to other actors (more like rebalancing) ? Any 
>> simple example somewhere I can take a look please?
>>
>> Thanks!
>>
>>
>>
>>
>> On Tuesday, March 14, 2017 at 4:52:43 AM UTC-7, kant kodali wrote:
>>>
>>> Hi All,
>>>
>>> I have Kafka as my live streaming source of data (This data isn't 
>>>  really events but rather just messages with a state) and I want to insert 
>>> this data into Cassandra but I have the following problem.
>>>
>>> Cassandra uses Last Write Wins Strategy using timestamps to resolve 
>>> conflicting writes. 
>>>
>>> By default, Cassandra enables server side timestamps and they are 
>>> monotonic per node. other words two nodes can produce the same timestamp 
>>> (although not often). So if they are two writes that go to two different 
>>> coordinator nodes and are trying to update the same Cassandra partition one 
>>> write will overwrite the other (we cannot deterministically say which one). 
>>> But from the user perspective it would look like both writes were 
>>> successful although we lost the state of one write request (Widely known 
>>> word to describe this anomaly is called "LOST UPDATES").  So if one doesn't 
>>> want this to happen Cassandra recommends to use client side timestamps but 
>>> we can run into the same problem in the following scenario.
>>>
>>> Client side Cassandra timestamps are monotonic by each client (By client 
>>> I mean think of it as a process that uses Cassandra driver API) so if one 
>>> has multiple processes which each of them having Cassandra driver api then 
>>> they can generate a same time stamp (although not often) and are trying to 
>>> update the same Cassandra partition then we will run into the same problem 
>>> as above. And multiple processes talking to Cassandra is very common in the 
>>> industry. In my case these multiple processes will be Kafka Consumers which 
>>> will consume data from Kafka and insert it into Cassandra. 
>>>
>>> If one of the two writes that are contending fails and other succeeds 
>>> such that a failed write can automatically retry using some mechanism in 
>>> Akka (then it will be an acceptable solution) but how do we do that?
>>>
>>> I somehow think there might be a nice reactive pattern using Akka 
>>> whether it is sharding or something else can help me solve this problem?
>>>
>>> Disclaimer: I am new to Akka and trying to put in lot of effort to learn 
>>> as quickly as possible so I will be open and thankful to any new ideas on 
>>> how to solve this problem in a scalable way as possible?
>>&

[akka-user] Akka Routing question

2017-03-16 Thread kant kodali
Hi All,

I have a stream of JSON encoded messages and I want to distribute them to 
group of actors or actor systems based on the field inside a message so say 
more like hash(key)->Actor but when the Actor dies I want to be able to 
hash the key to a different Actor that are available but at any given the 
hash of the key should always go to same Actor. Please let me know how I 
can achieve this with Akka?

Thanks,
kant

-- 
>>  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] Re: Cassandra Time Stamp Problem and How Akka can help?

2017-03-15 Thread kant kodali
What is each Entity if I may ask? By Entity you mean Actor? If I shard 
messages across group of actors or actor systems through some user 
specified function and say an actor or actor system(a node) dies then Does 
Akka redirect that shard to other actors (more like rebalancing) ? Any 
simple example somewhere I can take a look please?

Thanks!



On Tuesday, March 14, 2017 at 4:52:43 AM UTC-7, kant kodali wrote:
>
> Hi All,
>
> I have Kafka as my live streaming source of data (This data isn't  really 
> events but rather just messages with a state) and I want to insert this 
> data into Cassandra but I have the following problem.
>
> Cassandra uses Last Write Wins Strategy using timestamps to resolve 
> conflicting writes. 
>
> By default, Cassandra enables server side timestamps and they are 
> monotonic per node. other words two nodes can produce the same timestamp 
> (although not often). So if they are two writes that go to two different 
> coordinator nodes and are trying to update the same Cassandra partition one 
> write will overwrite the other (we cannot deterministically say which one). 
> But from the user perspective it would look like both writes were 
> successful although we lost the state of one write request (Widely known 
> word to describe this anomaly is called "LOST UPDATES").  So if one doesn't 
> want this to happen Cassandra recommends to use client side timestamps but 
> we can run into the same problem in the following scenario.
>
> Client side Cassandra timestamps are monotonic by each client (By client I 
> mean think of it as a process that uses Cassandra driver API) so if one has 
> multiple processes which each of them having Cassandra driver api then they 
> can generate a same time stamp (although not often) and are trying to 
> update the same Cassandra partition then we will run into the same problem 
> as above. And multiple processes talking to Cassandra is very common in the 
> industry. In my case these multiple processes will be Kafka Consumers which 
> will consume data from Kafka and insert it into Cassandra. 
>
> If one of the two writes that are contending fails and other succeeds such 
> that a failed write can automatically retry using some mechanism in Akka 
> (then it will be an acceptable solution) but how do we do that?
>
> I somehow think there might be a nice reactive pattern using Akka whether 
> it is sharding or something else can help me solve this problem?
>
> Disclaimer: I am new to Akka and trying to put in lot of effort to learn 
> as quickly as possible so I will be open and thankful to any new ideas on 
> how to solve this problem in a scalable way as possible?
>
> Thanks,
> kant
>

-- 
>>>>>>>>>>  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] Re: Naive question

2017-03-15 Thread kant kodali
 if my current state A = {key1: val1, key2: val2, ...key50: val50} and 
the next state B = {key1: val1, key2: val2, ...key5: val5} then 
Persistence actor would store A-B = {key6: val6, key7: val7, ...key50: 
val50} ?

On Tuesday, March 14, 2017 at 10:20:42 AM UTC-7, kant kodali wrote:
>
> Thanks for all the replies. When I first came across event sourcing it 
> clearly says one stores events and changes in the state but not the state 
> itself. so In my case, I get messages from Kafka and each message is say 
> JSON with 50 fields like this {key1: val1, key2: val2, ...key50: val50} 
> and every message will have all or subset of these keys. Now my goal is to 
> store these stream of messages as events in Cassandra and for me to store 
> the changes in state I always need to know the current state to see the 
> change in state caused by the next request but I wonder how this is done 
> typically with PersistenceActor? Any simplistic example would help a great 
> deal!
>
>
>
> On Sunday, March 12, 2017 at 7:09:06 AM UTC-7, kant kodali wrote:
>>
>> Hi,
>>
>> What does it mean when someone says we store the event itself rather than 
>> storing the state/data? such that the events can be replayed to store the 
>> state/data. Does it mean storing the functions/transformation itself 
>> (simply put the JVM byte code for the function itself) ?
>>
>> Thanks!
>> kant
>>
>

-- 
>>>>>>>>>>  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] Re: Naive question

2017-03-14 Thread kant kodali
Thanks for all the replies. When I first came across event sourcing it 
clearly says one stores events and changes in the state but not the state 
itself. so In my case, I get messages from Kafka and each message is say 
JSON with 50 fields like this {key1: val1, key2: val2, ...key50: val50} 
and every message will have all or subset of these keys. Now my goal is to 
store these stream of messages as events in Cassandra and for me to store 
the changes in state I always need to know the current state to see the 
change in state caused by the next request but I wonder how this is done 
typically with PersistenceActor? Any simplistic example would help a great 
deal!



On Sunday, March 12, 2017 at 7:09:06 AM UTC-7, kant kodali wrote:
>
> Hi,
>
> What does it mean when someone says we store the event itself rather than 
> storing the state/data? such that the events can be replayed to store the 
> state/data. Does it mean storing the functions/transformation itself 
> (simply put the JVM byte code for the function itself) ?
>
> Thanks!
> kant
>

-- 
>>>>>>>>>>  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] Cassandra Time Stamp Problem and How Akka can help?

2017-03-14 Thread kant kodali
Hi All,

I have Kafka as my live streaming source of data (This data isn't  really 
events but rather just messages with a state) and I want to insert this 
data into Cassandra but I have the following problem.

Cassandra uses Last Write Wins Strategy using timestamps to resolve 
conflicting writes. 

By default, Cassandra enables server side timestamps and they are monotonic 
per node. other words two nodes can produce the same timestamp (although 
not often). So if they are two writes that go to two different coordinator 
nodes and are trying to update the same Cassandra partition one write will 
overwrite the other (we cannot deterministically say which one). But from 
the user perspective it would look like both writes were successful 
although we lost the state of one write request (Widely known word to 
describe this anomaly is called "LOST UPDATES").  So if one doesn't want 
this to happen Cassandra recommends to use client side timestamps but we 
can run into the same problem in the following scenario.

Client side Cassandra timestamps are monotonic by each client (By client I 
mean think of it as a process that uses Cassandra driver API) so if one has 
multiple processes which each of them having Cassandra driver api then they 
can generate a same time stamp (although not often) and are trying to 
update the same Cassandra partition then we will run into the same problem 
as above. And multiple processes talking to Cassandra is very common in the 
industry. In my case these multiple processes will be Kafka Consumers which 
will consume data from Kafka and insert it into Cassandra. 

If one of the two writes that are contending fails and other succeeds such 
that a failed write can automatically retry using some mechanism in Akka 
(then it will be an acceptable solution) but how do we do that?

I somehow think there might be a nice reactive pattern using Akka whether 
it is sharding or something else can help me solve this problem?

Disclaimer: I am new to Akka and trying to put in lot of effort to learn as 
quickly as possible so I will be open and thankful to any new ideas on how 
to solve this problem in a scalable way as possible?

Thanks,
kant

-- 
>>  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] Re: How to listen to events on CassandraJournalProvider ?

2017-03-13 Thread kant kodali
Hi!

@Tal  say The actor that writes to a Cassandra data store is different from 
an Actor/Streaming source that polls from Cassandra. And if I understand 
this correctly you are saying the Actor that writes to Cassandra data store 
notifies to the Actor/streaming source that the write has been successful 
so it can poll from Cassandra. correct? 2) Can the streaming source be 
Spark? 3) Does Akka streaming source is a single process? I know that one 
can form clusters with Akka but I just want to know it is done typically 
when it comes to distribution and scalability? because if a single process 
has to catch up with a large stream I assume that may not scale well.

@Patrick Can I see a ticket or something I can follow?

Thanks much!

On Sunday, March 12, 2017 at 7:09:02 AM UTC-7, kant kodali wrote:
>
> Hi All,
>
> I am trying to understand event sourcing in detail and I am new to Akka. 
> One of book I was reading says a Persistence Actor will write events to a 
> Journal so in my case the Journal is Cassandra and one can have Persistence 
> Query Actor listen to the events from the Journal and this is where I don't 
> understand how it works. More specifically, How does Persistence Query 
> Actor know they are new events that it needs to Query for? I assume 
> Persistence Actor and Persistence Query Actor are two separate things (so 
> How does Persistence Query Actor gets notified that there are new events 
> written by Persistence Actor)
>
> I would like to get live stream from Cassandra but I as far as I know I 
> don't think there is any push based mechanism in Cassandra where Cassandra 
> itself will push new events to some message bus or application. please 
> correct me if I am wrong.
>
> Thanks,
> kant
>

-- 
>>>>>>>>>>  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] Naive question

2017-03-12 Thread kant kodali
Hi,

What does it mean when someone says we store the event itself rather than 
storing the state/data? such that the events can be replayed to store the 
state/data. Does it mean storing the functions/transformation itself 
(simply put the JVM byte code for the function itself) ?

Thanks!
kant

-- 
>>  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] How to listen to events on CassandraJournalProvider ?

2017-03-12 Thread kant kodali
Hi All,

I am trying to understand event sourcing in detail and I am new to Akka. 
One of book I was reading says a Persistence Actor will write events to a 
Journal so in my case the Journal is Cassandra and one can have Persistence 
Query Actor listen to the events from the Journal and this is where I don't 
understand how it works. More specifically, How does Persistence Query 
Actor know they are new events that it needs to Query for? I assume 
Persistence Actor and Persistence Query Actor are two separate things (so 
How does Persistence Query Actor gets notified that there are new events 
written by Persistence Actor)

I would like to get live stream from Cassandra but I as far as I know I 
don't think there is any push based mechanism in Cassandra where Cassandra 
itself will push new events to some message bus or application. please 
correct me if I am wrong.

Thanks,
kant

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