Change auto declaration to specify explicitly
diff --git a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/AMQPSession.java b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/AMQPSession.java
index 4a9b7ef..949bd20 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/AMQPSession.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/AMQPSession.java
@@ -22,7 +22,6 @@
   private final Properties properties;
   private Connection connection;
   private Channel publishChannel;
-  private String exchangeName;
 
   @Inject
   public AMQPSession(Properties properties) {
@@ -67,33 +66,36 @@
       try {
         Channel ch = connection.createChannel();
         LOGGER.info("Channel is opened.");
-        if (StringUtils.isNotEmpty(properties.getString(Keys.QUEUE_NAME))) {
-          LOGGER.info("Queue: " + properties.getString(Keys.QUEUE_NAME));
-          ch.queueDeclare(properties.getString(Keys.QUEUE_NAME),
-              properties.getBoolean(Keys.QUEUE_DURABLE),
-              properties.getBoolean(Keys.QUEUE_EXCLUSIVE),
-              properties.getBoolean(Keys.QUEUE_AUTODELETE), null);
-          exchangeName = "exchange-for-" + properties.getString(Keys.QUEUE_NAME);
+        if (properties.getBoolean(Keys.QUEUE_DECLARE)) {
+          LOGGER.info("Declare Queue...");
+          if (StringUtils.isNotEmpty(properties.getString(Keys.QUEUE_NAME))) {
+            LOGGER.info("Declare queue: " + properties.getString(Keys.QUEUE_NAME));
+            ch.queueDeclare(properties.getString(Keys.QUEUE_NAME),
+                properties.getBoolean(Keys.QUEUE_DURABLE),
+                properties.getBoolean(Keys.QUEUE_EXCLUSIVE),
+                properties.getBoolean(Keys.QUEUE_AUTODELETE), null);
+          }
+
+          if (properties.getBoolean(Keys.EXCHANGE_DECLARE)) {
+            LOGGER.info("Declare exchange: " + properties.getString(Keys.EXCHANGE_NAME));
+            ch.exchangeDeclare(properties.getString(Keys.EXCHANGE_NAME),
+                properties.getString(Keys.EXCHANGE_TYPE),
+                properties.getBoolean(Keys.EXCHANGE_DURABLE),
+                properties.getBoolean(Keys.EXCHANGE_AUTODELETE), null);
+          }
+
+          if (properties.getBoolean(Keys.BIND_STARTUP)) {
+            if (StringUtils.isNotEmpty(properties.getString(Keys.QUEUE_NAME))) {
+              LOGGER.info("Bind exchange and queue with key: " + properties.getString(Keys.BIND_ROUTINGKEY));
+              ch.queueBind(properties.getString(Keys.QUEUE_NAME),
+                  properties.getString(Keys.EXCHANGE_NAME),
+                  properties.getString(Keys.BIND_ROUTINGKEY));
+            }
+          }
+
+          publishChannel = ch;
+          LOGGER.info("Complete to setup channel.");
         }
-
-        if (StringUtils.isNotEmpty(properties.getString(Keys.EXCHANGE_NAME))) {
-          exchangeName = properties.getString(Keys.EXCHANGE_NAME);
-        }
-
-        LOGGER.info("Exchange: " + exchangeName);
-        ch.exchangeDeclare(exchangeName,
-            properties.getString(Keys.EXCHANGE_TYPE),
-            properties.getBoolean(Keys.EXCHANGE_DURABLE),
-            properties.getBoolean(Keys.EXCHANGE_AUTODELETE), null);
-
-        if (StringUtils.isNotEmpty(properties.getString(Keys.QUEUE_NAME))) {
-          LOGGER.info("Bind exchange and queue with key: " + properties.getString(Keys.BIND_ROUTINGKEY));
-          ch.queueBind(properties.getString(Keys.QUEUE_NAME),
-              exchangeName, properties.getString(Keys.BIND_ROUTINGKEY));
-        }
-
-        publishChannel = ch;
-        LOGGER.info("Complete to setup channel.");
       } catch (Exception ex) {
         LOGGER.warn("#bind: " + ex.getClass().getName());
         disconnect();
@@ -118,7 +120,9 @@
     if (publishChannel != null && publishChannel.isOpen()) {
       try {
         LOGGER.debug("Send message.");
-        publishChannel.basicPublish(exchangeName, properties.getString(Keys.MESSAGE_ROUTINGKEY), properties.getBasicProperties(),
+        publishChannel.basicPublish(properties.getString(Keys.EXCHANGE_NAME),
+            properties.getString(Keys.MESSAGE_ROUTINGKEY),
+            properties.getBasicProperties(),
             message.getBytes(CharEncoding.UTF_8));
       } catch (Exception ex) {
         LOGGER.warn("#sendMessage: " + ex.getClass().getName());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Keys.java b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Keys.java
index 42a094b..57a03ba 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Keys.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/rabbitmq/Keys.java
@@ -5,13 +5,16 @@
   AMQP_USERNAME("amqp.username", null, "guest"),
   AMQP_PASSWORD("amqp.password", null, "guest"),
   QUEUE_NAME("queue.name", null, ""),
+  QUEUE_DECLARE("queue.declare", null, false),
   QUEUE_DURABLE("queue.durable", null, true),
   QUEUE_AUTODELETE("queue.autoDelete", null, false),
   QUEUE_EXCLUSIVE("queue.exclusive", null, false),
-  EXCHANGE_NAME("exchange.name", null, ""),
+  EXCHANGE_NAME("exchange.name", null, "gerrit.publish"),
+  EXCHANGE_DECLARE("exchange.declare", null, false),
   EXCHANGE_TYPE("exchange.type", null, "fanout"),
   EXCHANGE_DURABLE("exchange.durable", null, false),
   EXCHANGE_AUTODELETE("exchange.autoDelete", null, false),
+  BIND_STARTUP("bind.startup", null, false),
   BIND_ROUTINGKEY("bind.routingKey", null, ""),
   MESSAGE_DELIVERY_MODE("message.deliveryMode", null, 1),
   MESSAGE_PRIORITY("message.priority", null, 0),
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index f7c73c7..a733472 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -10,15 +10,18 @@
     password = guest
   [queue]
     name = gerrit-queue
+    decralation = false
     durable = true
     autoDelete = false
     exclusive = false
   [exchange]
     name = exchange-for-gerrit-queue
+    declaration = false
     type = fanout
     durable = true
     autoDelete = false
   [bind]
+    startUp = false
     routingKey = com.foobar.www.gerrit
   [message]
     deliveryMode = 1
@@ -46,7 +49,11 @@
     specified, defaults to "guest".
 
 queue.name
-:   The name of queue. You must set this property if you want to publish message.
+:   The name of queue. If not specified, defaults to "".
+
+queue.declare
+:   true if you want to declare queue on startup. If not specified, defaults to false.
+    Also need to specify `queue.name`.
 
 queue.durable
 :   true if you want to declare a drable queue. If not specified, defaults to true.
@@ -58,7 +65,10 @@
 :   true if you want to declare an exclusive queue. If not specified, defaults to false.
 
 exchange.name
-:   The name of exchange. If not specified, defaults to "exchange-for-*queue.name*".
+:   The name of exchange. If not specified, defaults to "gerrit.publish".
+
+exchange.declare
+:   true if you want to declare exchange on startup. If not specified, defaults to false.
 
 exchange.type
 :   The type of exchange. You can specify the following value:
@@ -72,6 +82,10 @@
 exchange.autoDelete
 :   true if you want to declare an autodelete exchange. If not specified, defaults to false.
 
+bind.startup
+:   true if you want to bind queue to exchange on startup. If not specified, defaults to false.
+    Also need to specify `queue.name`.
+
 bind.routingKey
 :   The name of routing key. This is used to bind queue to exchange. If not specified, defaults to "".
 
@@ -88,10 +102,12 @@
 
 gerrit.name
 :   The name of gerrit(not hostname). This is your given name to identify your gerrit.
+    If not specified, defaults to "".
     This can be used for message header only.
 
 gerrit.hostname
 :   The hostname of gerrit for SCM connection.
+    If not specified, defaults to "".
     This can be used for message header only.
 
 gerrit.scheme