Community for yuuvis®

0 votes
in yuuvis Momentum by (500 points)

Hi Yuuvis Team

I would like to specify an additional AMPQ Hook. By default there is the textextraction queue which is being notified when a document is inserted. Now I would also like to notify a different queue to which a microservice will listen. But when I define the systemhooks as follows:

{"systemhooks" :
  {"amqp" : [
    {"enable" : true,
    "predicate" : "spel:(contentStreams != null && contentStreams.size() > 0 && contentStreams[0]['range'] != null && contentStreams[0]['range'].length() > 0) ? true : false",
    "type" : "object.insert.document",
    ...
    "queue" : "lc.textextraction",
    "bulkSize" : 1

  },
  {
    "enable": true,
    "predicate": "spel:true",
    "type": "object.insert.document", 
    "url": "rabbitmq.infrastructure:5672",
    "user": "...",
    "password": "...",
    "queue": "lc.processing",
    "bulkSize": 1
  }

],
"webhooks": …

I get the following exception in the log of the API pod after restarting it:

2020-06-04 13:27:12.850  INFO [api,,,] 6 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: route1 started and consuming from: direct://amqpOut

2020-06-04 13:27:12.850  INFO [api,,,] 6 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.24.0 (CamelContext: camel-1) is shutting down

2020-06-04 13:27:12.851  INFO [api,,,] 6 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)

2020-06-04 13:27:12.855  INFO [api,,,] 6 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: route1 shutdown complete, was consuming from: direct://amqpOut

2020-06-04 13:27:12.855  INFO [api,,,] 6 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds

2020-06-04 13:27:12.875  INFO [api,,,] 6 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.24.0 (CamelContext: camel-1) uptime 0.715 seconds

2020-06-04 13:27:12.876  INFO [api,,,] 6 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.24.0 (CamelContext: camel-1) is shutdown in 0.025 seconds

2020-06-04 13:27:12.879  INFO [api,,,] 6 --- [           main] org.eclipse.jetty.server.session         : node0 Stopped scavenging

2020-06-04 13:27:12.881  INFO [api,,,] 6 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@15994b0b{application,/,[file:///tmp/jetty-docbase.5564495294458225465.7450/, jar:file:/app.jar!/BOOT-INF/lib/swagger-ui-3.25.0.jar!/META-INF/resources, jar:file:/app.jar!/BOOT-INF/lib/angular__http-2.4.10.jar!/META-INF/resources],UNAVAILABLE}

2020-06-04 13:27:15.062 ERROR [api,,,] 6 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: direct://amqpOut

        at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1826)

        at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)

Each AMQP Hook on its own works fine. Am I doing something wrong in the definition? Can't I use the same type twice? Or is there some other restriction?

Kind regards

Nicole

1 Answer

0 votes
by (1.3k points)
selected by
 
Best answer
Hi Nicole, yes this will be available with the next release. Before that, you could add more than one hook, but only the first was used. In the upcoming release, you can use multiple hooks.

Welcome to the yuuvis® Community

Welcome to yuuvis® Q&A, where you can ask questions and receive answers from other members of the community.
...