Skip to content

Commit

Permalink
updating tests, removing all experimental comments for both service a…
Browse files Browse the repository at this point in the history
…nd simplification
  • Loading branch information
scottf committed Aug 17, 2023
1 parent 2e6eebf commit a77a841
Show file tree
Hide file tree
Showing 27 changed files with 11 additions and 42 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ A [Java](http://java.com) client for the [NATS messaging system](https://nats.io
[![Build Main Badge](https://github.com/nats-io/nats.java/actions/workflows/build-main.yml/badge.svg?event=push)](https://github.com/nats-io/nats.java/actions/workflows/build-main.yml)
[![Release Badge](https://github.com/nats-io/nats.java/actions/workflows/build-release.yml/badge.svg?event=release)](https://github.com/nats-io/nats.java/actions/workflows/build-release.yml)

## BETA / Experimental News

### Simplification

There is a new simplified api that makes working with streams and consumers well, simpler!
There is a new simplified api that makes working with streams and consumers well, simpler! Simplification is released as of 2.16.14.

Check out the examples:

Expand All @@ -28,7 +26,7 @@ Check out the examples:

### Service Framework

The service API allows you to easily build NATS services The services API is currently in beta functionality.
The service API allows you to easily build NATS services. The Service Framework is released as of 2.16.14

The Services Framework introduces a higher-level API for implementing services with NATS. NATS has always been a strong technology on which to build services, as they are easy to write, are location and DNS independent and can be scaled up or down by simply adding or removing instances of the service.

Expand All @@ -50,7 +48,7 @@ Version 2.5.0 adds some back pressure to publish calls to alleviate issues when

Previous versions are still available in the repo.

#### Version 2.16.14 Options properties improvements
#### Version 2.16.14 Options properties improvements

In this release, support was added to
* support properties keys with or without the prefix 'io.nats.client.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

/**
* This example will demonstrate simplified contexts
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class ContextExample {
private static final String STREAM = "context-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

/**
* This example will demonstrate simplified fetch
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class FetchBytesExample {
private static final String STREAM = "fetch-bytes-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

/**
* This example will demonstrate simplified fetch
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class FetchMessagesExample {
private static final String STREAM = "fetch-messages-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

/**
* This example will demonstrate simplified IterableConsumer where the developer calls nextMessage.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class IterableConsumerExample {
private static final String STREAM = "iterable-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

/**
* This example will demonstrate simplified consume with a handler
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class MessageConsumerExample {
private static final String STREAM = "consume-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

/**
* This example will demonstrate simplified next
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class NextExample {
private static final String STREAM = "next-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

/**
* This example will demonstrate simplified next
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class QueueExample {
private static final String STREAM = "q-stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.function.Supplier;

/**
* SERVICE IS AN EXPERIMENTAL API SUBJECT TO CHANGE
* This example demonstrates basic setup and use of the Service Framework
*/
public class ServiceExample {
public static void main(String[] args) throws IOException {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/BaseConsumeOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
/**
* Base Consume Options are provided to customize the way the consume and
* fetch operate. It is the base class for ConsumeOptions and FetchConsumeOptions.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class BaseConsumeOptions {
public static final int DEFAULT_MESSAGE_COUNT = 500;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/BaseConsumerContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

/**
* The Consumer Context provides a convenient interface around a defined JetStream Consumer
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public interface BaseConsumerContext {

Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/BaseMessageConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
/**
* The BaseMessageConsumer interface is the core interface replacing
* a subscription for a simplified consumer.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public interface BaseMessageConsumer extends AutoCloseable {
/**
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/io/nats/client/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ enum Status {
/**
* Get a consumer context for a specific named stream and specific named consumer.
* Verifies that the stream and consumer exist.
* EXPERIMENTAL API SUBJECT TO CHANGE
* @param streamName the name of the stream
* @param consumerName the name of the consumer
* @return a ConsumerContext object
Expand All @@ -589,7 +588,6 @@ enum Status {
/**
* Get a consumer context for a specific named stream and specific named consumer.
* Verifies that the stream and consumer exist.
* EXPERIMENTAL API SUBJECT TO CHANGE
* @param streamName the name of the stream
* @param consumerName the name of the consumer
* @param options JetStream options.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/ConsumeOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

/**
* Consume Options are provided to customize the consume operation.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class ConsumeOptions extends BaseConsumeOptions {
public static ConsumeOptions DEFAULT_CONSUME_OPTIONS = ConsumeOptions.builder().build();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/ConsumerContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

/**
* The Consumer Context provides a convenient interface around a defined JetStream Consumer
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public interface ConsumerContext extends BaseConsumerContext {
/**
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/FetchConsumeOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

/**
* Fetch Consume Options are provided to customize the fetch operation.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public class FetchConsumeOptions extends BaseConsumeOptions {
public static FetchConsumeOptions DEFAULT_FETCH_OPTIONS = FetchConsumeOptions.builder().build();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/FetchConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
/**
* A fetch consumer gets messages by calling nextMessage.
* nextMessage returns null when there are no more messages
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public interface FetchConsumer extends MessageConsumer {
/**
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/io/nats/client/JetStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ public interface JetStream {

/**
* Get a stream context for a specific named stream. Verifies that the stream exists.
* EXPERIMENTAL API SUBJECT TO CHANGE
* @param streamName the name of the stream
* @return a StreamContext object
* @throws IOException covers various communication issues with the NATS
Expand All @@ -492,7 +491,6 @@ public interface JetStream {
/**
* Get a consumer context for a specific named stream and specific named consumer.
* Verifies that the stream and consumer exist.
* EXPERIMENTAL API SUBJECT TO CHANGE
* @param streamName the name of the stream
* @param consumerName the name of the consumer
* @return a ConsumerContext object
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/MessageConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
/**
* The MessageConsumer interface is the core interface replacing
* a subscription for a simplified consumer.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public interface MessageConsumer extends AutoCloseable {
/**
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/io/nats/client/Nats.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ public static Connection connect(Options options) throws IOException, Interrupte
* <p>If there is an exception before a connection is created, and the error
* listener is set, it will be notified with a null connection.
*
* <p><strong>This method is experimental, please provide feedback on its value.</strong>
*
* @param options the connection options
* @param reconnectOnConnect if true, the connection will treat the initial
* connection as any other and attempt reconnects on
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/nats/client/OrderedConsumerContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
package io.nats.client;

/**
* The Consumer Context provides a convenient interface around a defined JetStream Consumer
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
* The Ordered Consumer and it's context provide a simplification interface to the ordered consumer behavior.
*/
public interface OrderedConsumerContext extends BaseConsumerContext {
}
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/ServerPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

/**
* Allows the developer to provide the list of servers to try for connecting/reconnecting
* IMPORTANT! ServerPool IS CURRENTLY EXPERIMENTAL AND SUBJECT TO CHANGE.
*/
public interface ServerPool {

Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/nats/client/StreamContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
/**
* The Stream Context provide a set of operations for managing the stream
* and its contents and for managing consumers.
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
*/
public interface StreamContext {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/nats/client/impl/NatsConsumerContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static io.nats.client.impl.NatsJetStreamSubscription.EXPIRE_ADJUSTMENT;

/**
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
* Implementation of Consumer Context
*/
public class NatsConsumerContext implements ConsumerContext, SimplifiedSubscriptionMaker {
private final Object stateLock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.time.Duration;

/**
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
* Implementation of Ordered Consumer Context
*/
public class NatsOrderedConsumerContext implements OrderedConsumerContext {
NatsConsumerContext impl;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/nats/client/impl/NatsStreamContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.List;

/**
* SIMPLIFICATION IS EXPERIMENTAL AND SUBJECT TO CHANGE
* Implementation of Stream Context
*/
class NatsStreamContext implements StreamContext {
final String streamName;
Expand Down
11 changes: 3 additions & 8 deletions src/test/java/io/nats/client/impl/PingTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void testPingTimerThroughReconnect() throws Exception {
NatsStatistics stats = nc.getNatsStatistics();

try {
assertTrue(Connection.Status.CONNECTED == nc.getStatus(), "Connected Status");
assertSame(Connection.Status.CONNECTED, nc.getStatus(), "Connected Status");
try {
Thread.sleep(200); // should get 10+ pings
} catch (Exception exp)
Expand All @@ -205,17 +205,12 @@ public void testPingTimerThroughReconnect() throws Exception {
ts.close();
handler.waitForStatusChange(5, TimeUnit.SECONDS);
pings = stats.getPings();
try {
Thread.sleep(200); // should get more pings
} catch (Exception exp)
{
//Ignore
}
Thread.sleep(250); // should get more pings
assertTrue(stats.getPings() > pings, "more pings");
Thread.sleep(1000);
} finally {
nc.close();
assertTrue(Connection.Status.CLOSED == nc.getStatus(), "Closed Status");
assertSame(Connection.Status.CLOSED, nc.getStatus(), "Closed Status");
}
}
}
Expand Down

0 comments on commit a77a841

Please sign in to comment.