Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Adaptor design

...

  1. Adaptor registration: POST on API to register (create) an adaptor.
  2. Adaptor start up: When an Adaptor process comes up, as part of the handshake, it sends an Adaptor ready message to the router. For example:

    //Create MessageServiceConfiguration builder to
    //build MessageServiceConfiguration and use it to get MessageService instance.
    // Use MessageService for interaction with router via message bus.
    MessageServiceConfiguration.Builder builder = MessageServiceConfiguration.newConfiguration();

    MessageServiceConfiguration msConf = builder.setBrokerUrl("nio+ssl://docker.local:61617"). setJmsClientId(jmsClientId).build();

    try {
    MessageService messageService = MessageServiceFactory.getMessageService(msConf);

    messageService.setListener(Constants.MessageType.OPS, adminListener); <-- Listener for OPS messages
    messageService.setListener(Constants.MessageType.DATA, dataListener); <-- Listener for Data messages

    //Made up object (AdaptorUp) for conveying the bootstrap information regarding an adaptor.

    AdaptorUp adaptorUp = new AdaptorUp();
    adaptorUp.setStatus("RUNNING");
    Map<String, String> capabilities = new HashMap<>();
    //Add capabilities list
    adaptorUp.setCapabilities(capabilities);
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    String upMessage = objectMapper.writeValueAsString(adaptorUp);
    //Send an OPS message

    messageService.sendMessage(Constants.MessageType.OPS, upMessage);  <-- Send Adaptor Up on OPS channel.

    //If everything goes fine, then the adminListener is notified by the router sends a message on OPS announcing the as it announces the initial state of this Adaptor.

    //If there is a problem, then the dataListener is notified of the error message.