Skip to content

Commit 6132f47

Browse files
committed
Fix README.md
1 parent 0a8fe53 commit 6132f47

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

encon/README.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project contains the general-purpose data-binding functionality.
44

55
## Usage
66

7-
First of all, add encon's dependency:
7+
First of all, add encon's dependency to your `JVM` app:
88

99
**Maven**:
1010

@@ -23,16 +23,16 @@ First of all, add encon's dependency:
2323
**Gradle**:
2424

2525
```groovy
26-
compile 'io.appulse.encon.java:encon:1.6.0'
26+
compile 'io.appulse.encon:encon:1.6.0'
2727
```
2828

29-
Let's create a new `Erlang` node:
29+
Then, create a new `Erlang` node, like this:
3030

3131
```java
3232

33-
import io.appulse.encon.java.config.NodeConfig;
34-
import io.appulse.encon.java.Node;
35-
import io.appulse.encon.java.Nodes;
33+
import io.appulse.encon.config.NodeConfig;
34+
import io.appulse.encon.Node;
35+
import io.appulse.encon.Nodes;
3636

3737

3838
// Creating node's config.
@@ -49,15 +49,9 @@ Node node = Nodes.singleNode("echo-node", config);
4949

5050
After `node` creation, we could register several mailboxes:
5151

52-
> **IMPORTANT:** The main differenece between `MailboxQueueType.NON_BLOCKING` and `MailboxQueueType.BLOCKING` mailbox types is the way to extract the values from a queue.
53-
>
54-
> * `MailboxQueueType.NON_BLOCKING` - uses java.util.Queue.poll() under the hood;
55-
>
56-
> * `MailboxQueueType.BLOCKING` - uses java.util.concurrent.BlockingQueue.take() method (automatically performs type checking)
57-
5852
```java
5953

60-
import static io.appulse.encon.java.terms.Erlang.tuple;
54+
import static io.appulse.encon.terms.Erlang.tuple;
6155

6256
import io.appulse.encon.connection.regular.Message;
6357
import io.appulse.encon.mailbox.Mailbox;
@@ -66,8 +60,8 @@ import io.appulse.encon.terms.ErlangTerm;
6660

6761
// Mailbox #1
6862
// ----------
69-
// Mailbox's type is `MailboxQueueType.BLOCKING`, by default
70-
// it uses `java.util.concurrent.LinkedBlockingQueue` under the hood.
63+
// By default Mailbox uses `java.util.concurrent.LinkedBlockingQueue`
64+
// under the hood.
7165
//
7266
Mailbox mailbox1 = node.mailbox()
7367
.name("echo-mailbox-1")
@@ -86,20 +80,20 @@ for (int count = 0; count < 3; count++) {
8680

8781
// Mailbox #2
8882
// ----------
89-
// Set your own `java.util.concurrent.BlockingQueue` instance.
83+
// You can set your own `java.util.concurrent.BlockingQueue` instance.
9084
// `java.util.concurrent.SynchronousQueue` instance in that case.
9185
//
92-
Mailbox mailbox3 = node.mailbox()
86+
Mailbox mailbox2 = node.mailbox()
9387
.name("echo-mailbox-2")
9488
.queue(new SynchronousQueue<>())
9589
.build();
9690

9791
while (true) {
98-
Message message = mailbox3.receive();
92+
Message message = mailbox2.receive();
9993

10094
ErlangTerm body = message.getBody();
101-
mailbox3.send("another-node", "another-mailbox", tuple(
102-
mailbox3.getPid(), body.getUnsafe(1)
95+
mailbox2.send("another-node", "another-mailbox", tuple(
96+
mailbox2.getPid(), body.getUnsafe(1)
10397
));
10498
}
10599

0 commit comments

Comments
 (0)