Skip to content

Commit dddfdaa

Browse files
committed
Merge branch 'master' of github.com:rabbitmq/rabbitmq-java-client
2 parents 17e9b3a + df689cf commit dddfdaa

12 files changed

+949
-43
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved.
2+
//
3+
// This software, the RabbitMQ Java client library, is triple-licensed under the
4+
// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2
5+
// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see
6+
// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL,
7+
// please see LICENSE-APACHE2.
8+
//
9+
// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
10+
// either express or implied. See the LICENSE file for specific language governing
11+
// rights and limitations of this software.
12+
//
13+
// If you have any questions regarding licensing, please contact us at
14+
// info@rabbitmq.com.
15+
16+
package com.rabbitmq.client;
17+
18+
import java.io.IOException;
19+
import java.util.Map;
20+
21+
/**
22+
* Callback interface to be notified of the cancellation of a consumer.
23+
* Prefer it over {@link Consumer} for a lambda-oriented syntax,
24+
* if you don't need to implement all the application callbacks.
25+
* @see DeliverCallback
26+
* @see ConsumerShutdownSignalCallback
27+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, CancelCallback)
28+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, ConsumerShutdownSignalCallback)
29+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, CancelCallback, ConsumerShutdownSignalCallback)
30+
* @since 5.0
31+
*/
32+
@FunctionalInterface
33+
public interface CancelCallback {
34+
35+
/**
36+
* Called when the consumer is cancelled for reasons <i>other than</i> by a call to
37+
* {@link Channel#basicCancel}. For example, the queue has been deleted.
38+
* See {@link Consumer#handleCancelOk} for notification of consumer
39+
* cancellation due to {@link Channel#basicCancel}.
40+
* @param consumerTag the <i>consumer tag</i> associated with the consumer
41+
* @throws IOException
42+
*/
43+
void handle(String consumerTag) throws IOException;
44+
45+
}

src/main/java/com/rabbitmq/client/Channel.java

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

src/main/java/com/rabbitmq/client/Consumer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
* because this will delay dispatch of messages to other {@link Consumer}s on the same
3434
* {@link Channel}.
3535
*
36+
* For a lambda-oriented syntax, use {@link DeliverCallback},
37+
* {@link CancelCallback}, and {@link ConsumerShutdownSignalCallback}.
38+
*
3639
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, java.util.Map, Consumer)
3740
* @see Channel#basicCancel
3841
*/
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved.
2+
//
3+
// This software, the RabbitMQ Java client library, is triple-licensed under the
4+
// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2
5+
// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see
6+
// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL,
7+
// please see LICENSE-APACHE2.
8+
//
9+
// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
10+
// either express or implied. See the LICENSE file for specific language governing
11+
// rights and limitations of this software.
12+
//
13+
// If you have any questions regarding licensing, please contact us at
14+
// info@rabbitmq.com.
15+
16+
package com.rabbitmq.client;
17+
18+
import java.util.Map;
19+
20+
/**
21+
* Callback interface to be notified when either the consumer channel
22+
* or the underlying connection has been shut down.
23+
* Prefer it over {@link Consumer} for a lambda-oriented syntax,
24+
* if you don't need to implement all the application callbacks.
25+
* @see CancelCallback
26+
* @see DeliverCallback
27+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, CancelCallback)
28+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, ConsumerShutdownSignalCallback)
29+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, CancelCallback, ConsumerShutdownSignalCallback)
30+
* @since 5.0
31+
*/
32+
@FunctionalInterface
33+
public interface ConsumerShutdownSignalCallback {
34+
35+
/**
36+
* Called when either the channel or the underlying connection has been shut down.
37+
* @param consumerTag the <i>consumer tag</i> associated with the consumer
38+
* @param sig a {@link ShutdownSignalException} indicating the reason for the shut down
39+
*/
40+
void handleShutdownSignal(String consumerTag, ShutdownSignalException sig);
41+
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved.
2+
//
3+
// This software, the RabbitMQ Java client library, is triple-licensed under the
4+
// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2
5+
// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see
6+
// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL,
7+
// please see LICENSE-APACHE2.
8+
//
9+
// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
10+
// either express or implied. See the LICENSE file for specific language governing
11+
// rights and limitations of this software.
12+
//
13+
// If you have any questions regarding licensing, please contact us at
14+
// info@rabbitmq.com.
15+
16+
package com.rabbitmq.client;
17+
18+
import java.io.IOException;
19+
import java.util.Map;
20+
21+
/**
22+
* Callback interface to be notified when a message is delivered.
23+
* Prefer it over {@link Consumer} for a lambda-oriented syntax,
24+
* if you don't need to implement all the application callbacks.
25+
* @see CancelCallback
26+
* @see ConsumerShutdownSignalCallback
27+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, CancelCallback)
28+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, ConsumerShutdownSignalCallback)
29+
* @see Channel#basicConsume(String, boolean, String, boolean, boolean, Map, DeliverCallback, CancelCallback, ConsumerShutdownSignalCallback)
30+
* @since 5.0
31+
*/
32+
@FunctionalInterface
33+
public interface DeliverCallback {
34+
35+
/**
36+
* Called when a <code><b>basic.deliver</b></code> is received for this consumer.
37+
* @param consumerTag the <i>consumer tag</i> associated with the consumer
38+
* @param message the delivered message
39+
* @throws IOException if the consumer encounters an I/O error while processing the message
40+
*/
41+
void handle(String consumerTag, Delivery message) throws IOException;
42+
43+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved.
2+
//
3+
// This software, the RabbitMQ Java client library, is triple-licensed under the
4+
// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2
5+
// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see
6+
// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL,
7+
// please see LICENSE-APACHE2.
8+
//
9+
// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
10+
// either express or implied. See the LICENSE file for specific language governing
11+
// rights and limitations of this software.
12+
//
13+
// If you have any questions regarding licensing, please contact us at
14+
// info@rabbitmq.com.
15+
16+
package com.rabbitmq.client;
17+
18+
/**
19+
* Encapsulates an arbitrary message - simple "bean" holder structure.
20+
*/
21+
public class Delivery {
22+
private final Envelope _envelope;
23+
private final AMQP.BasicProperties _properties;
24+
private final byte[] _body;
25+
26+
public Delivery(Envelope envelope, AMQP.BasicProperties properties, byte[] body) {
27+
_envelope = envelope;
28+
_properties = properties;
29+
_body = body;
30+
}
31+
32+
/**
33+
* Retrieve the message envelope.
34+
* @return the message envelope
35+
*/
36+
public Envelope getEnvelope() {
37+
return _envelope;
38+
}
39+
40+
/**
41+
* Retrieve the message properties.
42+
* @return the message properties
43+
*/
44+
public AMQP.BasicProperties getProperties() {
45+
return _properties;
46+
}
47+
48+
/**
49+
* Retrieve the message body.
50+
* @return the message body
51+
*/
52+
public byte[] getBody() {
53+
return _body;
54+
}
55+
}

src/main/java/com/rabbitmq/client/RpcServer.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -235,45 +235,6 @@ public String getQueueName() {
235235
return _queueName;
236236
}
237237

238-
/**
239-
* Encapsulates an arbitrary message - simple "bean" holder structure.
240-
*/
241-
public static class Delivery {
242-
private final Envelope _envelope;
243-
private final AMQP.BasicProperties _properties;
244-
private final byte[] _body;
245-
246-
public Delivery(Envelope envelope, AMQP.BasicProperties properties, byte[] body) {
247-
_envelope = envelope;
248-
_properties = properties;
249-
_body = body;
250-
}
251-
252-
/**
253-
* Retrieve the message envelope.
254-
* @return the message envelope
255-
*/
256-
public Envelope getEnvelope() {
257-
return _envelope;
258-
}
259-
260-
/**
261-
* Retrieve the message properties.
262-
* @return the message properties
263-
*/
264-
public AMQP.BasicProperties getProperties() {
265-
return _properties;
266-
}
267-
268-
/**
269-
* Retrieve the message body.
270-
* @return the message body
271-
*/
272-
public byte[] getBody() {
273-
return _body;
274-
}
275-
}
276-
277238
public interface RpcConsumer extends Consumer {
278239

279240
Delivery nextDelivery() throws InterruptedException, ShutdownSignalException, ConsumerCancelledException;

0 commit comments

Comments
 (0)