Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19133

camel-zookeeper - Zookeeper's service registration and discovery is not working with serialized

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.20.2
    • 3.20.3, 3.21.0, 4.0-M3, 4.0.0
    • camel-zookeeper
    • None
    • jdk17+springboot2.7.9+camel3.20.2

    • Unknown

    Description

      my code:

      @Component
      public class MyRouter extends RouteBuilder {
      @Value("${server.port}")
      String port;

      @Override
      public void configure() throws Exception {
      getCamelContext().addRoutePolicyFactory(new ServiceRegistrationRoutePolicyFactory());
      from("direct:1")
      .routeProperty(ServiceDefinition.SERVICE_META_NAME, "addHello")
      .routeProperty(ServiceDefinition.SERVICE_META_ID, "my-id" + port)
      .routeProperty(ServiceDefinition.SERVICE_META_PORT, port)
      .process(new Processor() {
      @Override
      public void process(Exchange exchange) throws Exception {
      exchange.getMessage().setBody(exchange.getMessage().getBody() + "hello");
      }
      })
      .log("${body}");
      from("timer://foo?fixedRate=true&period=1000")
      .serviceCall()
      .name("addHello")
      .zookeeperServiceDiscovery()
      .nodes("127.0.0.1")
      .basePath("/config")
      .end()
      .log("${body}");
      }
      }

      issue:

      The service registration function of zookeeper will carry type information during serialization
      {{ }}
      and an error will be reported due to different MetaData during deserialization
      {{ }}
      solution:
      The internal class MetaData in the ZooKeeperServiceDiscovery and ZooKeeperServiceRegistry needs to be extracted
      This is my modified patch in the camel-3.20.2 revision of the camel-zookeeper project

      Attachments

        1. changeMetaData.patch
          18 kB
          geyipeng
        2. image-2023-03-11-09-09-06-741.png
          28 kB
          geyipeng
        3. image-2023-03-11-09-11-24-022.png
          249 kB
          geyipeng

        Activity

          People

            davsclaus Claus Ibsen
            ggboy geyipeng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: