Skip to content

Document - Riemann-java-client internally caches DNS records #62

Open
@shanielh

Description

@shanielh

I'm doing it for documentation, Since I got a problem with it and I managed to solve it.

The TcpTransport and UdpTransport internally cache the IP address of a DNS record, It can be explicitly disabled.

My problem was that sometimes the riemann server changed the internal IP, And I got to it using an internal DNS, After that the riemann changed the IP, The client never sent events to the server.

The problem was that internal caching, I managed to cancel that caching using a simple code (The example given is in scala, But I'm sure you can write it in Java)

private def disableDnsCache(transport: Transport): Unit = {
  getDnsOption(transport).foreach(_.set(false))
}

private def getDnsOption(transport: Transport): Traversable[AtomicBoolean] = {
  transport match {
    case udp: UdpTransport => Some(udp.cacheDns)
    case tcp: TcpTransport => Some(tcp.cacheDns)
    case async: AsynchronizeTransport => getDnsOption(async.transport)
  }
}

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