Search in sources :

Example 1 with Connection

use of io.nats.client.Connection in project camel by apache.

the class NatsConsumerLoadTest method testLoadConsumer.

@Test
public void testLoadConsumer() throws InterruptedException, IOException, TimeoutException {
    mockResultEndpoint.setExpectedMessageCount(10000);
    ConnectionFactory cf = new ConnectionFactory("nats://localhost:4222");
    Connection connection = cf.createConnection();
    for (int i = 0; i < 10000; i++) {
        connection.publish("test", ("test" + i).getBytes());
    }
    mockResultEndpoint.assertIsSatisfied();
}
Also used : ConnectionFactory(io.nats.client.ConnectionFactory) Connection(io.nats.client.Connection) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

Connection (io.nats.client.Connection)1 ConnectionFactory (io.nats.client.ConnectionFactory)1 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)1 Test (org.junit.Test)1