Skip to content

Commit 03831ec

Browse files
committed
Styling changes
1 parent 2aa32bc commit 03831ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The handle incoming events, multiple actions are defined which can be used to im
7373

7474
`AcceptError`: Accept a incoming error message and apply it as a failure on a pending registration
7575

76-
`ConsumeStreamChunk`: Accept a incoming stream chunk and consume add it to the current running stream / Enumerator
76+
`ConsumeStreamChunk`: Accept a incoming stream chunk and consume add it to the current running stream
7777

7878
`EndStream`: Accept a incoming stream terminator and end the current ongoing stream
7979

@@ -132,6 +132,7 @@ import SimpleMessage._
132132
trait DefaultSimpleMessageHandler extends SentinelResolver[SimpleMessageFormat, SimpleMessageFormat] {
133133
def process = {
134134
case SimpleStreamChunk(x) if (x.length > 0) ConsumerAction.ConsumeStreamChunk else ConsumerAction.EndStream
135+
135136
case x: SimpleError ConsumerAction.AcceptError
136137
case x: SimpleReply ConsumerAction.AcceptSignal
137138
}
@@ -147,14 +148,17 @@ object SimpleServerHandler extends DefaultSimpleMessageHandler {
147148

148149
override def process = super.process orElse {
149150
case SimpleCommand(PING_PONG, payload) ProducerAction.Signal { x: SimpleCommand Future(SimpleReply("PONG")) }
151+
150152
case SimpleCommand(TOTAL_CHUNK_SIZE, payload) ProducerAction.ConsumeStream { x: SimpleCommand
151153
s: Enumerator[SimpleStreamChunk]
152154
s |>>> Iteratee.fold(0) { (b, a) b + a.payload.length } map (x SimpleReply(x.toString))
153155
}
156+
154157
case SimpleCommand(GENERATE_NUMBERS, payload) ProducerAction.ProduceStream { x: SimpleCommand
155158
val count = payload.toInt
156159
Future((Enumerator(List.range(0, count): _*) &> Enumeratee.map(x SimpleStreamChunk(x.toString))) >>> Enumerator(SimpleStreamChunk("")))
157160
}
161+
158162
case SimpleCommand(ECHO, payload) ProducerAction.Signal { x: SimpleCommand Future(SimpleReply(x.payload)) }
159163
}
160164
}
@@ -180,7 +184,7 @@ You can use the `randomRouting` / `roundRobinRouting` methods depending on the r
180184
### Server
181185
When the stages and resolver are defined, creation of a server is very straight forward:
182186

183-
``scala
187+
```scala
184188
SentinelServer(portNumber, SimpleServerHandler, "Server", SimpleMessage.stages)
185189
```
186190

@@ -231,7 +235,9 @@ Although functionality will be expanded in the future, it's currently also possi
231235
The following commands can be used to retrieve information:
232236

233237
`?`: Sends command to *one* (randomly chosen) connected socket for a answer, resulting in one event.
238+
234239
`?*`: Sends a command to all connected hosts, resulting in a list of events from each host individually.
240+
235241
`?**`: Sends a command to all connected sockets, resulting in a list of events from all connected sockets.
236242

237243
Simple server metrics are available through the `connectedSockets` and `connectedHosts` commands, returning a `Task[Int]` containing the corresponding count.

0 commit comments

Comments
 (0)