class AMQPPublisher extends AMQPWorker {

    void publish(byte[] bytes, BasicProperties properties, String routingKey, String exchange) {
        this.validateStringProperty("routingKey", routingKey);
        exchange = exchange == null ? "" : exchange.trim();
        if (exchange.length() == 0) {
            processLog.info("The 'exchangeName' is not specified. Messages will be sent to default exchange");
        }
        processLog.info("Successfully connected AMQPPublisher to " + this.connectionString + " and '" + exchange
                + "' exchange with '" + routingKey + "' as a routing key.");

        final Channel channel = getChannel();
        if (channel.isOpen()) {
            try {
                channel.basicPublish(exchange, routingKey, true, properties, bytes);
            } catch (Exception e) {
                throw new IllegalStateException("Failed to publish to Exchange '" + exchange + "' with Routing Key '" + routingKey + "'.", e);
            }
        } else {
            throw new IllegalStateException("This instance of AMQPPublisher is invalid since its publishingChannel is closed");
        }
    }

      AMQPPublisher(Connection connection, ComponentLog processLog);

}