Cettia 1.2 roadmap discussion

26 views
Skip to first unread message

Donghwan Kim

unread,
Sep 1, 2018, 8:46:55 AM9/1/18
to Cettia and Asity
Cettia 1.2, or rather Cettia Java Server 1.2, will focus on making socket handling even more declarative and expressive. Here's a roadmap so far. You can see the full list on the milestone page.
  • Drop support for Java 7
  • Add java.util.function.Predicate's default methods to ServerSocketPredicate
  • Enable to exclude certain sockets from a selection
  • Add finder methods to Sentence also
    • You can filter sockets within a sentence by finders i.e. server.byTag("room345").execute(/* do something */).byTag("admin").execute(/* and do something */)
The missing part is to offer various and useful finders like all and byTag. I've analyzed various examples in Ralph's cettia-demo and discovered the following finder candidates. A big kudos to Ralph as always!
  1. Sentence exclude(ServerSocket socket) - only for Sentence
    • As is: server.find(skt -> !socket.id().equals(skt.id())).send("chat", msg); origin 
    • To be: server.all().exclude(socket).send("chat", msg);
  2. Server/Sentence byAttr(String name, Object value)
    • As is: server.find(/*receiver(receiverId)*/ skt -> skt.get("clientId").equals(receiverId)).send("offer", msg); origin
    • To be: server.byAttr("clientId", receiverId).send("offer", msg);
Including the above proposal, I would like to gather your opinions for 1.2. Any feedback would be welcome!

-- Donghwan

Ralph Schaer

unread,
Sep 3, 2018, 8:39:58 AM9/3/18
to Cettia and Asity
Hi

I like the changes. But there is one change that confuses me a little bit. Is this an AND conjunction?
server.byTag("room345").execute(/* do something */).byTag("admin").execute(/* and do something */)

Is the second execute called on sockets that have the tags "room345" AND "admin"? 
Or is it an independent clause? First execute called on all sockets with tag "room345", second execute called on all sockets with tag "admin"?

Ralph

Donghwan Kim

unread,
Sep 3, 2018, 9:14:38 AM9/3/18
to Cettia and Asity
Hi Ralph,

Thanks for your feedback. I intended an AND condition to improve the reusability of Sentence. While the first byTag belongs to Server interface (1.0), the second one belongs to the Sentence interface (1.2).

Sentence room = server.byTag("room345").execute(/* do something */);
room.byTag("admin").execute(/* and do something */);

Are you still confused about finders in Sentence?

-- Donghwan

Ralph Schaer

unread,
Sep 3, 2018, 9:35:41 AM9/3/18
to Cettia and Asity
Thanks for the clarification.
It makes sense and could be useful. 

Ralph

Donghwan Kim

unread,
Sep 8, 2018, 1:17:25 PM9/8/18
to Cettia and Asity
I've just created https://github.com/cettia/cettia-java-server/issues/35 for byAttr, and guess we could release 1.2.0-Beta1 in a month. Any contribution is welcome.

-- Donghwan

Donghwan Kim

unread,
Sep 27, 2018, 10:06:01 AM9/27/18
to Cettia and Asity
I just came back from Thanksgiving holidays :) Before working on the feature list, I would like to discuss Server/Sentence API style first. There are two styles to support more rich expression to find sockets:

1. Add finders to Server and Sentence - Cettia 1.0-1.1
2. Write pre-defined socket predicates and use them with server.find and sentence.find - inspired by Spring's RequestPredicates and RequestPredicate

Here is an example to find sockets tagged with foo and bar to help you understand.

1. server.byTag(foo, bar)
2. server.find(tag(foo).and(tag(bar))) w/ static import io.cettia.ServerSocketPredicates.*;

In this case, the first case looks more concise but if we want to find sockets tagged with tag1 or tag2, it becomes lengthy.

1. server.find(socket -> socket.tags().contains(foo) || socket.tags().contains(bar))
2. server.find(tag(foo).or(tag(bar)))

Even though we add a new method for this case, the same problem happens when finding sockets tagged with tag1 or tag2 and tag3 (tag1 || (tag2 && tag3)). I'm inclined to adopt the second option since Java 8 is the minimum requirement as of 1.2 but never used static imports to be honest. Do you guys have any opinion?

Thanks,

-- Donghwan

Donghwan Kim

unread,
Oct 29, 2018, 8:59:42 AM10/29/18
to Cettia and Asity
Hello folks,

We've just finished to update the tutorial with features added in Cettia Java Server 1.2 and are going to release the GA next week. If you want to check new features now, see 'Advanced Socket Handling' section of the tutorial.

https://cettia.io/guides/cettia-tutorial/#advanced-socket-handling

-- Donghwan
Reply all
Reply to author
Forward
0 new messages