Skip to content

PulsarApplication.newInstance doesn't throw if connecting to Pulsar fails w multipleTopicsPattern  #79

@paasovaara

Description

@paasovaara

PulsarApplication.newInstance should abort and close if we cannot connect to Pulsar. This will happen if we have single topic but if multipleTopics=true, the app will just stay in the loop.

Steps to reproduce:

  1. shut down Pulsar
  2. environment.conf:
include "common.conf"

pulsar {
  consumer {
    #topic="omm-service-alert"
    multipleTopics=true
    multipleTopics=${?PULSAR_CONSUMER_ENABLE_MULTIPLE_TOPICS}
    topicsPattern="persistent://public/default/(omm-service-alert|omm-cancellations)"
    topicsPattern=${?PULSAR_CONSUMER_MULTIPLE_TOPICS_PATTERN}
    subscription="transitlog-event-source-sub"
    subscription=${?PULSAR_CONSUMER_SUBSCRIPTION}
  }
  producer {
    enabled = false
  }
}

output:

{"timestamp":"2019-04-29T06:58:47.352Z","level":"INFO","thread":"main","logger":"fi.hsl.common.pulsar.PulsarApplication","message":"Creating Pulsar consumer for multiple topics using pattern: persistent://public/default/(omm-service-alert|omm-cancellations)","context":"default"}
{"timestamp":"2019-04-29T06:58:47.556Z","level":"WARN","thread":"pulsar-client-io-1-1","logger":"org.apache.pulsar.client.impl.ConnectionPool","message":"Failed to open connection to localhost:6650 : org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:6650","context":"default"}
{"timestamp":"2019-04-29T06:58:47.660Z","level":"WARN","thread":"pulsar-external-listener-3-1","logger":"org.apache.pulsar.client.impl.BinaryProtoLookupService","message":"[namespace: public/default] Could not get connection while getTopicsUnderNamespace -- Will try again in 100 ms","context":"default"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions