Skip to content

Commit 9c10628

Browse files
d0x7scottf
andauthored
Remove Schema related leftovers (#1263)
* Remove Schema related leftovers Closes #1262 * Undo removal of spec breaking changes * Added @deprecated annotation * Update ServiceTests.java * Update ServiceTests.java --------- Co-authored-by: Scott Fauerbach <[email protected]>
1 parent d841f65 commit 9c10628

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The service API allows you to easily build NATS services. The Service Framework
5353

5454
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.
5555

56-
The Services Framework further streamlines their development by providing observability and standardization. The Service Framework allows your services to be discovered, queried for status and schema information without additional work.
56+
The Services Framework further streamlines their development by providing observability and standardization. The Service Framework allows your services to be discovered and queried for status without additional work.
5757

5858
Check out the [ServiceExample](src/examples/java/io/nats/examples/service/ServiceExample.java)
5959

src/main/java/io/nats/service/Service.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public class Service {
6565

6666
// set up the service contexts
6767
// ? do we need an internal dispatcher for any user endpoints
68-
// ! also while we are here, we need to collect the endpoints for the SchemaResponse
6968
Dispatcher dTemp = null;
7069
serviceContexts = new HashMap<>();
7170
for (ServiceEndpoint se : b.serviceEndpoints.values()) {
@@ -87,7 +86,7 @@ public class Service {
8786
pingResponse = new PingResponse(id, b.name, b.version, b.metadata);
8887
infoResponse = new InfoResponse(id, b.name, b.version, b.metadata, b.description, b.serviceEndpoints.values());
8988

90-
if (b.pingDispatcher == null || b.infoDispatcher == null || b.schemaDispatcher == null || b.statsDispatcher == null) {
89+
if (b.pingDispatcher == null || b.infoDispatcher == null || b.statsDispatcher == null) {
9190
dTemp = conn.createDispatcher();
9291
dInternals.add(dTemp);
9392
}

src/main/java/io/nats/service/ServiceBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class ServiceBuilder {
2626
Duration drainTimeout = DEFAULT_DRAIN_TIMEOUT;
2727
Dispatcher pingDispatcher;
2828
Dispatcher infoDispatcher;
29-
Dispatcher schemaDispatcher;
3029
Dispatcher statsDispatcher;
3130

3231
/**
@@ -130,12 +129,13 @@ public ServiceBuilder infoDispatcher(Dispatcher infoDispatcher) {
130129
}
131130

132131
/**
133-
* Optional dispatcher for the schema service
132+
* A NOOP method to maintain compatibility with the old schema dispatcher, superseded by endpointMetadata
133+
* @deprecated No longer used, see {@link ServiceEndpoint.Builder#endpointMetadata(Map)} instead
134134
* @param schemaDispatcher the dispatcher
135135
* @return the ServiceBuilder
136136
*/
137+
@Deprecated
137138
public ServiceBuilder schemaDispatcher(Dispatcher schemaDispatcher) {
138-
this.schemaDispatcher = schemaDispatcher;
139139
return this;
140140
}
141141

src/test/java/io/nats/service/ServiceTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,11 @@ public void testDispatchers() throws Exception {
404404

405405
Dispatcher dPing = nc.createDispatcher();
406406
Dispatcher dInfo = nc.createDispatcher();
407-
Dispatcher dSchema = nc.createDispatcher();
408407
Dispatcher dStats = nc.createDispatcher();
409408
Dispatcher dEnd = nc.createDispatcher();
410409

411410
dispatchers = getDispatchers(nc);
412-
assertEquals(5, dispatchers.size());
411+
assertEquals(4, dispatchers.size());
413412

414413
ServiceEndpoint se1 = ServiceEndpoint.builder()
415414
.endpointName("dispatch")
@@ -424,7 +423,6 @@ public void testDispatchers() throws Exception {
424423
.addServiceEndpoint(se1)
425424
.pingDispatcher(dPing)
426425
.infoDispatcher(dInfo)
427-
.schemaDispatcher(dSchema)
428426
.statsDispatcher(dStats)
429427
.build();
430428

@@ -434,11 +432,10 @@ public void testDispatchers() throws Exception {
434432
done.get(100, TimeUnit.MILLISECONDS);
435433

436434
dispatchers = getDispatchers(nc);
437-
assertEquals(5, dispatchers.size()); // stop doesn't touch supplied dispatchers
435+
assertEquals(4, dispatchers.size()); // stop doesn't touch supplied dispatchers
438436

439437
nc.closeDispatcher(dPing);
440438
nc.closeDispatcher(dInfo);
441-
nc.closeDispatcher(dSchema);
442439
sleep(100); // no rush
443440

444441
dispatchers = getDispatchers(nc);

0 commit comments

Comments
 (0)