Skip to content

Commit

Permalink
Swapped out nats client library - which seems to be the issue with fa…
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdavies committed Jun 7, 2016
1 parent 108ac22 commit 466e7d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
22 changes: 7 additions & 15 deletions jnatsd/src/test/java/io/fabric8/msg/jnatsd/TestLoad.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@

package io.fabric8.msg.jnatsd;

import io.nats.client.Connection;
import io.nats.client.ConnectionFactory;
import io.nats.client.Message;
import io.nats.client.MessageHandler;
import io.nats.client.Subscription;
import io.fabric8.msg.jnatsd.embedded.EmbeddedConnection;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -39,14 +35,11 @@ public class TestLoad {

@Autowired
private JNatsd jNatsd;
private ConnectionFactory connectionFactory;

@Before
public void before() throws Exception {
jNatsd.getConfiguration().setClientPort(0);
jNatsd.start();
connectionFactory = new ConnectionFactory();
connectionFactory.setServers("nats://0.0.0.0:" + jNatsd.getServerInfo().getPort());
}

@After
Expand All @@ -56,17 +49,16 @@ public void after() throws Exception {

@Test
public void testLoad() throws Exception {
Connection subConnection = connectionFactory.createConnection();
EmbeddedConnection subConnection = new EmbeddedConnection(jNatsd);
subConnection.start();
final int count = 1000;
CountDownLatch countDownLatch = new CountDownLatch(count);
Subscription subscription = subConnection.subscribe("foo", new MessageHandler() {
@Override
public void onMessage(Message message) {
countDownLatch.countDown();
}
subConnection.addSubscriber("foo", msg -> {
countDownLatch.countDown();
});

Connection pubConnection = connectionFactory.createConnection();
EmbeddedConnection pubConnection = new EmbeddedConnection(jNatsd);
pubConnection.start();

long start = System.currentTimeMillis();

Expand Down
2 changes: 0 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@
<module>example-message-consumer</module>
<module>example-message-producer</module>
<module>fabric8-camel</module>
<!--
<module>jnatsd</module>
-->
<module>kafka</module>
<module>message-broker</module>
<module>message-gateway</module>
Expand Down

0 comments on commit 466e7d6

Please sign in to comment.