Class RabbitMQOutputBuilder

java.lang.Object
io.jstach.rainbowgum.rabbitmq.RabbitMQOutputBuilder
All Implemented Interfaces:
LogBuilder<RabbitMQOutputBuilder,RabbitMQOutput>

Builder to create RabbitMQOutput. Creates a RabbitMQOutput.
Properties retrieved from LogProperties
Property Pattern Type Required Default Description
"logging.output.{name}.uri" URI false null Passed to the rabbitmq connection factory.
"logging.output.{name}.exchange" String true "logging" Exchange to send messages to.
"logging.output.{name}.routingKey" String (converted) false null The logging event level will be used by default.
"logging.output.{name}.declareExchange" Boolean false null Declare exchange on start. Default is false.
"logging.output.{name}.host" String false null Host.
"logging.output.{name}.username" String false null Set user name if not null outside of URI.
"logging.output.{name}.password" String false null Set password if not null outside of URI.
"logging.output.{name}.port" Integer false null Set port if not null.
"logging.output.{name}.appId" String false null Sets the message appId if not null.
"logging.output.{name}.connectionName" String false null Connection name if not null.
"logging.output.{name}.exchangeType" String false "topic" Exchange type like "topic" covered in rabbitmq doc.
"logging.output.{name}.virtualHost" String false null Sets virtualhost if not null.
  • Constructor Details

    • RabbitMQOutputBuilder

      Create a builder for io.jstach.rainbowgum.rabbitmq.RabbitMQOutput .
      Parameters:
      name - will fill {name} in logging.output.{name}.. Used to resolve config and give the output a name.
  • Method Details

    • uri

      public RabbitMQOutputBuilder uri(@Nullable URI uri)
      Sets uri. Passed to the rabbitmq connection factory. Default is null.
      Parameters:
      uri - "logging.output.{name}.uri" = java.net.URI Passed to the rabbitmq connection factory.
      Returns:
      this builder.
    • exchange

      Sets required exchange. Exchange to send messages to. Default is "logging".
      Parameters:
      exchange - "logging.output.{name}.exchange" = java.lang.String Exchange to send messages to.
      Returns:
      this builder.
    • routingKey

      public RabbitMQOutputBuilder routingKey(@Nullable Function<LogEvent,String> routingKey)
      Sets routingKey. The logging event level will be used by default. Default is null.
      Parameters:
      routingKey - "logging.output.{name}.routingKey" = java.util.function.Function The logging event level will be used by default.
      Returns:
      this builder.
    • declareExchange

      public RabbitMQOutputBuilder declareExchange(@Nullable Boolean declareExchange)
      Sets declareExchange. Declare exchange on start. Default is false. Default is null.
      Parameters:
      declareExchange - "logging.output.{name}.declareExchange" = java.lang.Boolean Declare exchange on start. Default is false.
      Returns:
      this builder.
    • host

      public RabbitMQOutputBuilder host(@Nullable String host)
      Sets host. Host. Default is null.
      Parameters:
      host - "logging.output.{name}.host" = java.lang.String Host.
      Returns:
      this builder.
    • username

      public RabbitMQOutputBuilder username(@Nullable String username)
      Sets username. Set user name if not null outside of URI. Default is null.
      Parameters:
      username - "logging.output.{name}.username" = java.lang.String Set user name if not null outside of URI.
      Returns:
      this builder.
    • password

      public RabbitMQOutputBuilder password(@Nullable String password)
      Sets password. Set password if not null outside of URI. Default is null.
      Parameters:
      password - "logging.output.{name}.password" = java.lang.String Set password if not null outside of URI.
      Returns:
      this builder.
    • port

      public RabbitMQOutputBuilder port(@Nullable Integer port)
      Sets port. Set port if not null. Default is null.
      Parameters:
      port - "logging.output.{name}.port" = java.lang.Integer Set port if not null.
      Returns:
      this builder.
    • appId

      public RabbitMQOutputBuilder appId(@Nullable String appId)
      Sets appId. Sets the message appId if not null. Default is null.
      Parameters:
      appId - "logging.output.{name}.appId" = java.lang.String Sets the message appId if not null.
      Returns:
      this builder.
    • connectionName

      public RabbitMQOutputBuilder connectionName(@Nullable String connectionName)
      Sets connectionName. Connection name if not null. Default is null.
      Parameters:
      connectionName - "logging.output.{name}.connectionName" = java.lang.String Connection name if not null.
      Returns:
      this builder.
    • exchangeType

      public RabbitMQOutputBuilder exchangeType(@Nullable String exchangeType)
      Sets exchangeType. Exchange type like "topic" covered in rabbitmq doc. Default is "topic".
      Parameters:
      exchangeType - "logging.output.{name}.exchangeType" = java.lang.String Exchange type like "topic" covered in rabbitmq doc.
      Returns:
      this builder.
    • virtualHost

      public RabbitMQOutputBuilder virtualHost(@Nullable String virtualHost)
      Sets virtualHost. Sets virtualhost if not null. Default is null.
      Parameters:
      virtualHost - "logging.output.{name}.virtualHost" = java.lang.String Sets virtualhost if not null.
      Returns:
      this builder.
    • build

      Creates io.jstach.rainbowgum.rabbitmq.RabbitMQOutput from this builder.
      Returns:
      io.jstach.rainbowgum.rabbitmq.RabbitMQOutput .
    • fromProperties

      Description copied from interface: LogBuilder
      Will try to convert string key values to parameters needed by the builder.
      Specified by:
      fromProperties in interface LogBuilder<RabbitMQOutputBuilder,RabbitMQOutput>
      Parameters:
      properties - log properties
      Returns:
      this.
    • toProperties

      public void toProperties(BiConsumer<String,String> consumer)
      Turns the builder into java.util.Properties like Map skipping values that are null.
      Parameters:
      consumer - apply is called where first arg is key and second is value.
    • propertyPrefix

      The interpolated property prefix: "logging.output.{name}.".
      Specified by:
      propertyPrefix in interface LogBuilder<RabbitMQOutputBuilder,RabbitMQOutput>
      Returns:
      resolved prefix which should end with a ".".
      See Also: