Java Code Examples for io.vertx.servicediscovery.types.MessageSource#createRecord()

The following examples show how to use io.vertx.servicediscovery.types.MessageSource#createRecord() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageSourceExamples.java    From vertx-service-discovery with Apache License 2.0 6 votes vote down vote up
public void example1(ServiceDiscovery discovery) {
  Record record = MessageSource.createRecord(
      "some-message-source-service", // The service name
      "some-address" // The event bus address
  );

  discovery.publish(record, ar -> {
    // ...
  });

  record = MessageSource.createRecord(
      "some-other-message-source-service", // The service name
      "some-address", // The event bus address
      "examples.MyData" // The payload type
  );
}
 
Example 2
Source File: AuditVerticleTest.java    From vertx-microservices-workshop with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp(TestContext tc) {
  Async async = tc.async();
  vertx = Vertx.vertx();
  Record record = MessageSource.createRecord("portfolio-events", "portfolio", JsonObject
      .class);
  ServiceDiscovery.create(vertx, new ServiceDiscoveryOptions()
      .setBackendConfiguration(new JsonObject().put("backend-name", DefaultServiceDiscoveryBackend.class.getName())))
      .publish(record,
          r -> {
            if (r.failed()) {
              r.cause().printStackTrace();
              tc.fail(r.cause());
            }
            vertx.deployVerticle(AuditVerticle.class.getName(), new DeploymentOptions().setConfig(CONFIGURATION), tc.asyncAssertSuccess(s -> async.complete()));
          });
}
 
Example 3
Source File: MessageSourceExamples.java    From vertx-service-discovery with Apache License 2.0 5 votes vote down vote up
public void example1(ServiceDiscovery discovery) {
  Record record1 = MessageSource.createRecord(
      "some-message-source-service", // The service name
      "some-address", // The event bus address
      JsonObject.class // The message payload type
  );

  Record record2 = MessageSource.createRecord(
      "some-other-message-source-service", // The service name
      "some-address", // The event bus address
      JsonObject.class, // The message payload type
      new JsonObject().put("some-metadata", "some value")
  );
}
 
Example 4
Source File: MicroserviceVerticle.java    From microtrader with MIT License 4 votes vote down vote up
public void publishMessageSource(String name, String address, Class contentClass, Handler<AsyncResult<Void>>
        completionHandler) {
    Record record = MessageSource.createRecord(name, address, contentClass);
    publish(record, completionHandler);
}
 
Example 5
Source File: MicroserviceVerticle.java    From microtrader with MIT License 4 votes vote down vote up
public void publishMessageSource(String name, String address, Handler<AsyncResult<Void>>
        completionHandler) {
    Record record = MessageSource.createRecord(name, address);
    publish(record, completionHandler);
}
 
Example 6
Source File: BaseMicroserviceVerticle.java    From vertx-blueprint-microservice with Apache License 2.0 4 votes vote down vote up
protected Future<Void> publishMessageSource(String name, String address) {
  Record record = MessageSource.createRecord(name, address);
  return publish(record);
}
 
Example 7
Source File: BaseMicroserviceRxVerticle.java    From vertx-blueprint-microservice with Apache License 2.0 4 votes vote down vote up
protected Single<Void> publishMessageSource(String name, String address) {
  Record record = MessageSource.createRecord(name, address);
  return publish(record);
}
 
Example 8
Source File: MicroServiceVerticle.java    From vertx-microservices-workshop with Apache License 2.0 4 votes vote down vote up
public void publishMessageSource(String name, String address, Class<?> contentClass, Handler<AsyncResult<Void>>
    completionHandler) {
  Record record = MessageSource.createRecord(name, address, contentClass);
  publish(record, completionHandler);
}
 
Example 9
Source File: MicroServiceVerticle.java    From vertx-microservices-workshop with Apache License 2.0 4 votes vote down vote up
public void publishMessageSource(String name, String address, Handler<AsyncResult<Void>>
    completionHandler) {
  Record record = MessageSource.createRecord(name, address);
  publish(record, completionHandler);
}