Skip to content

Commit

Permalink
revert ConsumerConfiguration changes where some fields were downgrade… (
Browse files Browse the repository at this point in the history
  • Loading branch information
scottf authored Jul 4, 2022
1 parent c725606 commit c41d960
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 65 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ The java-nats client is provided in a single jar file, with a single external de

### Downloading the Jar

You can download the latest jar at [https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.4/jnats-2.15.4.jar](https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.4/jnats-2.15.4.jar).
You can download the latest jar at [https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.5/jnats-2.15.5.jar](https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.5/jnats-2.15.5.jar).

The examples are available at [https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.4/jnats-2.15.4-examples.jar](https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.4/jnats-2.15.4-examples.jar).
The examples are available at [https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.5/jnats-2.15.5-examples.jar](https://search.maven.org/remotecontent?filepath=io/nats/jnats/2.15.5/jnats-2.15.5-examples.jar).

To use NKeys, you will need the ed25519 library, which can be downloaded at [https://repo1.maven.org/maven2/net/i2p/crypto/eddsa/0.3.0/eddsa-0.3.0.jar](https://repo1.maven.org/maven2/net/i2p/crypto/eddsa/0.3.0/eddsa-0.3.0.jar).

Expand All @@ -89,7 +89,7 @@ The NATS client is available in the Maven central repository, and can be importe

```groovy
dependencies {
implementation 'io.nats:jnats:2.15.4'
implementation 'io.nats:jnats:2.15.5'
}
```

Expand All @@ -115,7 +115,7 @@ repositories {
}
dependencies {
implementation 'io.nats:jnats:2.15.4-SNAPSHOT'
implementation 'io.nats:jnats:2.15.5-SNAPSHOT'
}
```

Expand All @@ -127,7 +127,7 @@ The NATS client is available on the Maven central repository, and can be importe
<dependency>
<groupId>io.nats</groupId>
<artifactId>jnats</artifactId>
<version>2.15.4</version>
<version>2.15.5</version>
</dependency>
```

Expand Down Expand Up @@ -161,7 +161,7 @@ If you need a snapshot version, you must enable snapshots and change your depend
<dependency>
<groupId>io.nats</groupId>
<artifactId>jnats</artifactId>
<version>2.15.4-SNAPSHOT</version>
<version>2.15.5-SNAPSHOT</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
// src/main/java/io/nats/client/Nats.java
// src/main/java/io/nats/client/package-info.java
// CHANGELOG.md
def jarVersion = "2.15.4"
def jarVersion = "2.15.5"

def isRelease = System.getenv("BUILD_EVENT") == "release"

Expand Down
10 changes: 10 additions & 0 deletions src/examples/java/io/nats/examples/ExampleArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum Trail {MESSAGE, COUNT, QUEUE_AND_COUNT}
public String queue;
public String message;
public int msgCount = Integer.MIN_VALUE;
public int msgSize = Integer.MIN_VALUE;
private boolean msgCountUnlimitedFlag;
public int subCount = Integer.MIN_VALUE;
public String stream;
Expand Down Expand Up @@ -140,6 +141,9 @@ private void handleKeyedArg(String key, String value) {
case "-mcnt":
msgCount = Integer.parseInt(value);
break;
case "-msize":
msgSize = Integer.parseInt(value);
break;
case "-scnt":
subCount = Integer.parseInt(value);
break;
Expand Down Expand Up @@ -188,6 +192,7 @@ public void displayBanner() {
_banner("durable", durable);
_banner("deliver", deliverSubject);
_banner("msgCount", msgCount, msgCountUnlimitedFlag);
_banner("msgSize", msgSize);
_banner("subCount", subCount);
_banner("pullSize", pullSize);
_banner("Headers", headers == null || headers.size() == 0 ? Integer.MIN_VALUE : headers.size());
Expand Down Expand Up @@ -256,6 +261,11 @@ public Builder defaultMsgCount(int msgCount, boolean unlimitedFlag) {
return this;
}

public Builder defaultMsgSize(int msgSize) {
ea.msgSize = msgSize;
return this;
}

public Builder defaultSubCount(int subCount) {
ea.subCount = subCount;
return this;
Expand Down
4 changes: 2 additions & 2 deletions src/examples/java/io/nats/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ You can also just insert some code before the arguments are processed to set the
In the examples, the usage will show `java <program> -cp <classpath> ...` Make sure you add both the client library and examples into the classpath. For example:

```bash
java -cp build/libs/jnats-2.15.4-SNAPSHOT.jar:build/libs/jnats-2.15.4-SNAPSHOT-examples.jar io.nats.examples.NatsPub nats://localhost:4222 test "hello world"
java -cp build/libs/jnats-2.15.5-SNAPSHOT.jar:build/libs/jnats-2.15.5-SNAPSHOT-examples.jar io.nats.examples.NatsPub nats://localhost:4222 test "hello world"
```

### Some examples depend on others
Expand All @@ -108,7 +108,7 @@ java -Djavax.net.ssl.keyStore=src/test/resources/keystore.jks -Djavax.net.ssl.ke
To run with the completely unverified client:

```bash
java -cp build/libs/jnats-2.15.4-SNAPSHOT.jar:build/libs/jnats-2.15.4-SNAPSHOT-examples.jar io.nats.examples.NatsSub opentls://localhost:4443 test 3
java -cp build/libs/jnats-2.15.5-SNAPSHOT.jar:build/libs/jnats-2.15.5-SNAPSHOT-examples.jar io.nats.examples.NatsSub opentls://localhost:4443 test 3
```

There are a set tls configuration for the server in the test files that can be used to run the NATS server.
Expand Down
26 changes: 19 additions & 7 deletions src/examples/java/io/nats/examples/jetstream/NatsJsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,41 @@ public static StreamInfo createStreamOrUpdateSubjects(Connection nc, String stre
// PUBLISH
// ----------------------------------------------------------------------------------------------------
public static void publish(Connection nc, String subject, int count) throws IOException, JetStreamApiException {
publish(nc.jetStream(), subject, "data", count, false);
publish(nc.jetStream(), subject, "data", count, -1, false);
}

public static void publish(JetStream js, String subject, int count) throws IOException, JetStreamApiException {
publish(js, subject, "data", count, false);
publish(js, subject, "data", count, -1, false);
}

public static void publish(JetStream js, String subject, String prefix, int count) throws IOException, JetStreamApiException {
publish(js, subject, prefix, count, true);
publish(js, subject, prefix, count, -1, true);
}

public static void publish(JetStream js, String subject, String prefix, int count, boolean verbose) throws IOException, JetStreamApiException {
publish(js, subject, prefix, count, -1, verbose);
}

public static void publish(JetStream js, String subject, String prefix, int count, int msgSize, boolean verbose) throws IOException, JetStreamApiException {
if (verbose) {
System.out.print("Publish ->");
}
for (int x = 1; x <= count; x++) {
String data = prefix + x;
String text = prefix + x;
if (verbose) {
System.out.print(" " + data);
System.out.print(" " + text);
}

byte[] data = text.getBytes(StandardCharsets.US_ASCII);
if (msgSize > data.length) {
byte[] larger = new byte[msgSize];
System.arraycopy(data, 0, larger, 0, data.length);
data = larger;
}
Message msg = NatsMessage.builder()
Message msg =
NatsMessage.builder()
.subject(subject)
.data(data.getBytes(StandardCharsets.US_ASCII))
.data(data)
.build();
js.publish(msg);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/nats/client/JetStreamSubscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public interface JetStreamSubscription extends Subscription {
* @return the message iterator
* @throws IllegalStateException if not a pull subscription.
*/
Iterator<Message> iterate(final int batchSize, Duration maxWait);
Iterator<Message> iterate(int batchSize, Duration maxWait);

/**
* Prepares an iterator. This uses <code>pullExpiresIn</code> under the covers,
Expand All @@ -187,7 +187,7 @@ public interface JetStreamSubscription extends Subscription {
* @return the message iterator
* @throws IllegalStateException if not a pull subscription.
*/
Iterator<Message> iterate(final int batchSize, long maxWaitMillis);
Iterator<Message> iterate(int batchSize, long maxWaitMillis);

/**
* Prepares a reader. A reader looks like a push sync subscription,
Expand All @@ -204,7 +204,7 @@ public interface JetStreamSubscription extends Subscription {
* @return the message iterator
* @throws IllegalStateException if not a pull subscription.
*/
JetStreamReader reader(final int batchSize, int repullAt);
JetStreamReader reader(int batchSize, int repullAt);

/**
* Gets information about the consumer behind this subscription.
Expand Down
Loading

0 comments on commit c41d960

Please sign in to comment.