4545 * </ul>
4646 * <p>
4747 *
48- * While a Channel can be used by multiple threads, it's important to ensure
49- * that only one thread executes a command at once. Concurrent execution of
50- * commands will likely cause an UnexpectedFrameError to be thrown.
48+ * <p>
49+ * {@link Channel} instances are safe for use by multiple
50+ * threads. Requests into a {@link Channel} are serialized, with only one
51+ * thread running commands at a time.
52+ * As such, applications may prefer using a {@link Channel} per thread
53+ * instead of sharing the same <code>Channel</code> across multiple threads.
54+ *
55+ * An <b>important caveat</b> to this is that confirms are <b>not</b> handled
56+ * properly when a {@link Channel} is shared between multiple threads. In that
57+ * scenario, it is therefore important to ensure that the {@link Channel}
58+ * instance is <b>not</b> accessed concurrently by multiple threads.
5159 *
5260 */
5361
@@ -231,7 +239,7 @@ public interface Channel extends ShutdownNotifier {
231239 void basicQos (int prefetchCount ) throws IOException ;
232240
233241 /**
234- * Publish a message with both "mandatory" and "immediate" flags set to false
242+ * Publish a message
235243 * @see com.rabbitmq.client.AMQP.Basic.Publish
236244 * @param exchange the exchange to publish the message to
237245 * @param routingKey the routing key
@@ -246,8 +254,22 @@ public interface Channel extends ShutdownNotifier {
246254 * @see com.rabbitmq.client.AMQP.Basic.Publish
247255 * @param exchange the exchange to publish the message to
248256 * @param routingKey the routing key
249- * @param mandatory true if we are requesting a mandatory publish
250- * @param immediate true if we are requesting an immediate publish
257+ * @param mandatory true if the 'mandatory' flag is to be set
258+ * @param props other properties for the message - routing headers etc
259+ * @param body the message body
260+ * @throws java.io.IOException if an error is encountered
261+ */
262+ void basicPublish (String exchange , String routingKey , boolean mandatory , BasicProperties props , byte [] body )
263+ throws IOException ;
264+
265+ /**
266+ * Publish a message
267+ * @see com.rabbitmq.client.AMQP.Basic.Publish
268+ * @param exchange the exchange to publish the message to
269+ * @param routingKey the routing key
270+ * @param mandatory true if the 'mandatory' flag is to be set
271+ * @param immediate true if the 'immediate' flag is to be
272+ * set. Note that the RabbitMQ server does not support this flag.
251273 * @param props other properties for the message - routing headers etc
252274 * @param body the message body
253275 * @throws java.io.IOException if an error is encountered
@@ -347,9 +369,9 @@ Exchange.DeclareOk exchangeDeclare(String exchange,
347369 * Bind an exchange to an exchange, with no extra arguments.
348370 * @see com.rabbitmq.client.AMQP.Exchange.Bind
349371 * @see com.rabbitmq.client.AMQP.Exchange.BindOk
350- * @param destination: the name of the exchange to which messages flow across the binding
351- * @param source: the name of the exchange from which messages flow across the binding
352- * @param routingKey: the routine key to use for the binding
372+ * @param destination the name of the exchange to which messages flow across the binding
373+ * @param source the name of the exchange from which messages flow across the binding
374+ * @param routingKey the routine key to use for the binding
353375 * @return a binding-confirm method if the binding was successfully created
354376 * @throws java.io.IOException if an error is encountered
355377 */
@@ -359,10 +381,10 @@ Exchange.DeclareOk exchangeDeclare(String exchange,
359381 * Bind an exchange to an exchange.
360382 * @see com.rabbitmq.client.AMQP.Exchange.Bind
361383 * @see com.rabbitmq.client.AMQP.Exchange.BindOk
362- * @param destination: the name of the exchange to which messages flow across the binding
363- * @param source: the name of the exchange from which messages flow across the binding
364- * @param routingKey: the routine key to use for the binding
365- * @param arguments: other properties (binding parameters)
384+ * @param destination the name of the exchange to which messages flow across the binding
385+ * @param source the name of the exchange from which messages flow across the binding
386+ * @param routingKey the routine key to use for the binding
387+ * @param arguments other properties (binding parameters)
366388 * @return a binding-confirm method if the binding was successfully created
367389 * @throws java.io.IOException if an error is encountered
368390 */
@@ -372,9 +394,9 @@ Exchange.DeclareOk exchangeDeclare(String exchange,
372394 * Unbind an exchange from an exchange, with no extra arguments.
373395 * @see com.rabbitmq.client.AMQP.Exchange.Bind
374396 * @see com.rabbitmq.client.AMQP.Exchange.BindOk
375- * @param destination: the name of the exchange to which messages flow across the binding
376- * @param source: the name of the exchange from which messages flow across the binding
377- * @param routingKey: the routine key to use for the binding
397+ * @param destination the name of the exchange to which messages flow across the binding
398+ * @param source the name of the exchange from which messages flow across the binding
399+ * @param routingKey the routine key to use for the binding
378400 * @return a binding-confirm method if the binding was successfully created
379401 * @throws java.io.IOException if an error is encountered
380402 */
@@ -384,10 +406,10 @@ Exchange.DeclareOk exchangeDeclare(String exchange,
384406 * Unbind an exchange from an exchange.
385407 * @see com.rabbitmq.client.AMQP.Exchange.Bind
386408 * @see com.rabbitmq.client.AMQP.Exchange.BindOk
387- * @param destination: the name of the exchange to which messages flow across the binding
388- * @param source: the name of the exchange from which messages flow across the binding
389- * @param routingKey: the routine key to use for the binding
390- * @param arguments: other properties (binding parameters)
409+ * @param destination the name of the exchange to which messages flow across the binding
410+ * @param source the name of the exchange from which messages flow across the binding
411+ * @param routingKey the routine key to use for the binding
412+ * @param arguments other properties (binding parameters)
391413 * @return a binding-confirm method if the binding was successfully created
392414 * @throws java.io.IOException if an error is encountered
393415 */
0 commit comments