├── .github
└── dependabot.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── findbugs.excludes.xml
├── lib
├── gson-2.2.4.jar
├── logback-classic-1.1.2.jar
├── logback-core-1.1.2.jar
├── netty-all-4.0.21.Final.jar
├── slf4j-api-1.7.5.jar
└── stateless4j-2.5.0.jar
├── mqlight-distribution
├── maven_install.cmd
├── maven_install.sh
├── pom.xml
└── src
│ └── assembly
│ └── bin.xml
├── mqlight-samples
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── ibm
│ │ └── mqlight
│ │ └── api
│ │ └── samples
│ │ ├── ArgumentParser.java
│ │ ├── Receive.java
│ │ ├── Send.java
│ │ └── UiWorkout.java
│ └── test
│ └── java
│ └── com
│ └── ibm
│ └── mqlight
│ └── api
│ └── samples
│ └── TestArgumentParser.java
├── mqlight
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── ibm
│ │ └── mqlight
│ │ └── api
│ │ ├── BytesDelivery.java
│ │ ├── ClientException.java
│ │ ├── ClientOptions.java
│ │ ├── ClientRuntimeException.java
│ │ ├── ClientState.java
│ │ ├── CompletionListener.java
│ │ ├── Delivery.java
│ │ ├── DestinationAdapter.java
│ │ ├── DestinationListener.java
│ │ ├── JsonDelivery.java
│ │ ├── MalformedDelivery.java
│ │ ├── NetworkException.java
│ │ ├── NonBlockingClient.java
│ │ ├── NonBlockingClientAdapter.java
│ │ ├── NonBlockingClientListener.java
│ │ ├── NotPermittedException.java
│ │ ├── Promise.java
│ │ ├── QOS.java
│ │ ├── ReplacedException.java
│ │ ├── SecurityException.java
│ │ ├── SendOptions.java
│ │ ├── StartingException.java
│ │ ├── StateException.java
│ │ ├── StoppedException.java
│ │ ├── StringDelivery.java
│ │ ├── SubscribeOptions.java
│ │ ├── SubscribedException.java
│ │ ├── UnsubscribedException.java
│ │ ├── callback
│ │ └── CallbackService.java
│ │ ├── doc-files
│ │ └── sm.gif
│ │ ├── endpoint
│ │ ├── Endpoint.java
│ │ ├── EndpointPromise.java
│ │ └── EndpointService.java
│ │ ├── impl
│ │ ├── BytesDeliveryImpl.java
│ │ ├── CompletionFuture.java
│ │ ├── Component.java
│ │ ├── ComponentImpl.java
│ │ ├── DeliveryImpl.java
│ │ ├── DestinationListenerWrapper.java
│ │ ├── FSMActions.java
│ │ ├── InternalSend.java
│ │ ├── InternalStart.java
│ │ ├── InternalStop.java
│ │ ├── InternalSubscribe.java
│ │ ├── InternalUnsubscribe.java
│ │ ├── JsonDeliveryImpl.java
│ │ ├── LogbackLogging.java
│ │ ├── MalformedDeliveryImpl.java
│ │ ├── Message.java
│ │ ├── NonBlockingClientImpl.java
│ │ ├── NonBlockingClientListenerWrapper.java
│ │ ├── NonBlockingClientState.java
│ │ ├── NonBlockingClientTrigger.java
│ │ ├── NonBlockingFSMFactory.java
│ │ ├── QueueableWork.java
│ │ ├── StringDeliveryImpl.java
│ │ ├── SubscriptionTopic.java
│ │ ├── callback
│ │ │ ├── CallbackExceptionNotification.java
│ │ │ ├── CallbackPromiseImpl.java
│ │ │ ├── FlushResponse.java
│ │ │ ├── SameThreadCallbackService.java
│ │ │ └── ThreadPoolCallbackService.java
│ │ ├── endpoint
│ │ │ ├── BluemixEndpointService.java
│ │ │ ├── EndpointImpl.java
│ │ │ ├── EndpointPromiseImpl.java
│ │ │ ├── EndpointResponse.java
│ │ │ ├── EndpointServiceImpl.java
│ │ │ ├── ExhaustedResponse.java
│ │ │ └── SingleEndpointService.java
│ │ ├── engine
│ │ │ ├── CloseRequest.java
│ │ │ ├── CloseResponse.java
│ │ │ ├── DeliveryRequest.java
│ │ │ ├── DeliveryResponse.java
│ │ │ ├── DisconnectNotification.java
│ │ │ ├── DrainNotification.java
│ │ │ ├── Engine.java
│ │ │ ├── EngineConnection.java
│ │ │ ├── OpenRequest.java
│ │ │ ├── OpenResponse.java
│ │ │ ├── SendRequest.java
│ │ │ ├── SendResponse.java
│ │ │ ├── SubscribeRequest.java
│ │ │ ├── SubscribeResponse.java
│ │ │ ├── UnsubscribeRequest.java
│ │ │ └── UnsubscribeResponse.java
│ │ ├── logging
│ │ │ ├── FFDC.java
│ │ │ ├── Javacore.java
│ │ │ ├── LogMarker.java
│ │ │ ├── LoggerFactoryImpl.java
│ │ │ ├── LoggerImpl.java
│ │ │ ├── Version.java
│ │ │ └── logback
│ │ │ │ ├── ArgsConverter.java
│ │ │ │ ├── ClientIdConverter.java
│ │ │ │ ├── IndentConverter.java
│ │ │ │ ├── LevelConverter.java
│ │ │ │ ├── LogFilter.java
│ │ │ │ ├── LogbackLoggingImpl.java
│ │ │ │ ├── ObjectIdConverter.java
│ │ │ │ ├── PIDConverter.java
│ │ │ │ ├── TIDConverter.java
│ │ │ │ └── TraceFilter.java
│ │ ├── network
│ │ │ ├── ConnectResponse.java
│ │ │ ├── ConnectionError.java
│ │ │ ├── DataRead.java
│ │ │ ├── DisconnectResponse.java
│ │ │ ├── NettyNetworkService.java
│ │ │ ├── NetworkClosePromiseImpl.java
│ │ │ ├── NetworkConnectPromiseImpl.java
│ │ │ ├── NetworkListenerImpl.java
│ │ │ ├── NetworkWritePromiseImpl.java
│ │ │ ├── WriteResponse.java
│ │ │ └── ssl
│ │ │ │ └── SSLEngineFactory.java
│ │ └── timer
│ │ │ ├── CancelResponse.java
│ │ │ ├── PopResponse.java
│ │ │ ├── TimerPromiseImpl.java
│ │ │ └── TimerServiceImpl.java
│ │ ├── logging
│ │ ├── FFDCProbeId.java
│ │ ├── Logger.java
│ │ └── LoggerFactory.java
│ │ ├── network
│ │ ├── NetworkChannel.java
│ │ ├── NetworkListener.java
│ │ └── NetworkService.java
│ │ ├── package.html
│ │ ├── resources
│ │ └── mqlight-logback.xml
│ │ ├── security
│ │ ├── KeyStoreUtils.java
│ │ └── PemFile.java
│ │ └── timer
│ │ └── TimerService.java
│ └── test
│ └── java
│ └── com
│ └── ibm
│ └── mqlight
│ └── api
│ ├── TestClientOptions.java
│ ├── TestNonBlockingClient.java
│ ├── TestNonBlockingClientAdapter.java
│ ├── TestSSLClientOptions.java
│ ├── TestSendOptions.java
│ ├── TestSubscribeOptions.java
│ └── impl
│ ├── MockComponent.java
│ ├── TestDeliveryImpl.java
│ ├── TestDestinationListenerWrapper.java
│ ├── TestNonBlockingClientImpl.java
│ ├── callback
│ ├── MockCallbackPromise.java
│ ├── TestCallbackPromiseImpl.java
│ ├── TestSameThreadCallbackService.java
│ └── TestThreadPoolCallbackService.java
│ ├── endpoint
│ ├── MockEndpointPromise.java
│ ├── TestBluemixEndpointService.java
│ ├── TestEndpointImpl.java
│ ├── TestEndpointPromiseImpl.java
│ └── TestSingleEndpointService.java
│ ├── engine
│ ├── MockNetworkChannel.java
│ └── TestEngine.java
│ ├── logging
│ ├── MockEvent.java
│ ├── MockLogger.java
│ ├── TestLoggerImpl.java
│ └── logback
│ │ ├── MockILoggingEvent.java
│ │ ├── TestArgsConverter.java
│ │ ├── TestClientIdConverter.java
│ │ ├── TestIndentConverter.java
│ │ ├── TestLevelConverter.java
│ │ ├── TestLogFilter.java
│ │ ├── TestLogbackLoggingImpl.java
│ │ ├── TestObjectIdlConverter.java
│ │ ├── TestPIDConverter.java
│ │ ├── TestTIDConverter.java
│ │ └── TestTraceFilter.java
│ ├── network
│ ├── Event.java
│ ├── MockNetworkClosePromise.java
│ ├── MockNetworkConnectPromise.java
│ ├── MockNetworkListener.java
│ ├── MockNetworkWritePromise.java
│ ├── TestNettyNetworkService.java
│ ├── TestNetworkClosePromise.java
│ ├── TestNetworkConnectPromiseImpl.java
│ ├── TestNetworkListenerImpl.java
│ └── TestNetworkWritePromiseImpl.java
│ └── timer
│ ├── TestTimerPromise.java
│ └── TestTimerService.java
└── pom.xml
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: maven
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | open-pull-requests-limit: 10
8 | ignore:
9 | - dependency-name: org.apache.qpid:proton-j
10 | versions:
11 | - 0.32.0
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | pom.xml.tag
3 | pom.xml.releaseBackup
4 | pom.xml.versionsBackup
5 | pom.xml.next
6 | release.properties
7 | dependency-reduced-pom.xml
8 | buildNumber.properties
9 | .mvn/timing.properties
10 | javacore.*.txt
11 | **/.classpath
12 | **/.project
13 | **/.settings
14 | **/bin
15 | .fbExcludeFilterFile
16 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ---
2 | language: java
3 | jdk:
4 | - oraclejdk8
5 | - oraclejdk7
6 | sudo: false
7 | branches:
8 | only:
9 | - master
10 |
--------------------------------------------------------------------------------
/findbugs.excludes.xml:
--------------------------------------------------------------------------------
1 |
21 | DeliveryListener
. That is to say that once passed to the
32 | * DeliveryListener
the client will never modify the data held
33 | * in this buffer.
34 | */
35 | ByteBuffer getData();
36 | }
37 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/ClientException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * Superclass of all MQ Light specific client checked exceptions
23 | */
24 | public class ClientException extends Exception {
25 |
26 | private static final long serialVersionUID = 5343791367613494183L;
27 |
28 | public ClientException(String message, Throwable cause) {
29 | super(message, cause);
30 | }
31 |
32 | public ClientException(String message) {
33 | super(message);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/ClientRuntimeException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * Superclass of all MQ Light specific client unchecked exceptions
23 | */
24 | public class ClientRuntimeException extends RuntimeException {
25 |
26 | private static final long serialVersionUID = -7670482333474200402L;
27 |
28 | public ClientRuntimeException(String message) {
29 | super(message);
30 | }
31 |
32 | public ClientRuntimeException(String message, Throwable cause) {
33 | super(message, cause);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/ClientState.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * An enumeration used to describe the state of the MQ Light client. This is the state
23 | * machine backing the client:
24 | *
25 | */
26 | public enum ClientState {
27 | STARTING, STARTED, STOPPING, STOPPED, RETRYING
28 | }
29 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/CompletionListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * A listener for completion of
NonBlockingClient
operations. For example:
23 | *
24 | * NonBlockingClient client = // ... initialization code 25 | * 26 | * client.send("/kittens", "Hello kitty!", new CompletionListener() { 27 | * public void onSuccess(NonBlockingClient c, // c == client 28 | * Object ctx) { 29 | * // ... code for handling success of send operation 30 | * } 31 | * public void onError(NonBlockingClient c, // c == client 32 | * Object ctx, 33 | * ClientCheckedException exception) { 34 | * // ... code for handing failure of send operation - for example: 35 | * exception.printStackTrace(); // The reason the operation failed. 36 | * } 37 | * }, null); // This value is passed into the listener as the context argument... 38 | *39 | */ 40 | public interface CompletionListener
null
if the JSON is a representation of null).
40 | * @throws JsonSyntaxException if the JSON data cannot be deserialized into an object of type classOfT
.
41 | */
42 | null
if the JSON is a representation of null).
51 | * @throws JsonSyntaxException if the JSON data cannot be deserialized into an object of type typeOfT
.
52 | */
53 | String
representation of the JSON. This allows other parsers to be used.
64 | */
65 | String getRawData();
66 | }
67 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/MalformedDelivery.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | public interface MalformedDelivery extends BytesDelivery {
22 |
23 | /**
24 | * Describes the reason that a message has been delivered using the onMalformed(...)
25 | * method.
26 | */
27 | enum MalformedReason {
28 | FORMATNOMAPPING,
29 | JMSNOMAPPING,
30 | PAYLOADENCODING,
31 | PAYLOADNOTAMQP
32 | }
33 |
34 | MalformedReason getReason();
35 |
36 | String getDescription();
37 |
38 | String getMQMDFormat();
39 |
40 | int getMQMDCodedCharSetId();
41 | }
42 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/NetworkException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * Used to indicate that a client has failed due to a network related problem. In this case
23 | * the client is disconnected from the MQ Light server and notified using an
24 | * instance of this exception.
25 | */
26 | public class NetworkException extends ClientException {
27 |
28 | private static final long serialVersionUID = -1910478698106122154L;
29 |
30 | public NetworkException(String message) {
31 | super(message);
32 | }
33 |
34 | public NetworkException(String message, Throwable cause) {
35 | super(message, cause);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/NonBlockingClientAdapter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | import com.ibm.mqlight.api.logging.Logger;
22 | import com.ibm.mqlight.api.logging.LoggerFactory;
23 |
24 | /**
25 | * An abstract adapter class for receiving client events. The methods in this class are empty.
26 | * This class exists as convenience for creating client listener objects. Extend this class to
27 | * create a NonBlockingClientListener
object and override the methods for the events of interest.
28 | * (If you implement the NonBlockingClientListener
interface, you have to define all of the methods in it.
29 | * This abstract class defines null methods for them all, so you can only have to define methods for
30 | * events you care about.)
31 | */
32 | public abstract class NonBlockingClientAdapterString
object containing the textual data.
29 | */
30 | String getData();
31 | }
32 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/SubscribedException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * A type of {@link StateException} to indicate that the client is attempting to subscribe to a destination for which the client is already subscribed.
23 | */
24 | public class SubscribedException extends StateException {
25 |
26 | private static final long serialVersionUID = 2792420197537041736L;
27 |
28 | public SubscribedException(String message) {
29 | super(message);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/UnsubscribedException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api;
20 |
21 | /**
22 | * A type of {@link StateException} to indicate that the client is attempting to unsubscribe from a destination for which the client is not already subscribed.
23 | */
24 | public class UnsubscribedException extends StateException {
25 |
26 | private static final long serialVersionUID = 2198833574106117937L;
27 |
28 | public UnsubscribedException(String message) {
29 | super(message);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/callback/CallbackService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api.callback;
20 |
21 | import com.ibm.mqlight.api.NonBlockingClient;
22 | import com.ibm.mqlight.api.Promise;
23 |
24 | /**
25 | * Plug point for callback executing implementations. The implementation used for an
26 | * instance of the client can be specified using the
27 | * {@link NonBlockingClient#create(com.ibm.mqlight.api.endpoint.EndpointService, com.ibm.mqlight.api.callback.CallbackService, com.ibm.mqlight.api.network.NetworkService, com.ibm.mqlight.api.timer.TimerService, com.google.gson.GsonBuilder, com.ibm.mqlight.api.ClientOptions, com.ibm.mqlight.api.NonBlockingClientListener, Object)}
28 | * method.
29 | */
30 | public interface CallbackService {
31 |
32 | /**
33 | * Run the specified runnable. This method will be invoked each time the client
34 | * needs to call back into application code.
35 | *
36 | * @param runnable the Runnable
to run.
37 | * @param orderingCtx an object that is used to order the execution of runnables.
38 | * The implementor of this interface must ensure that if two
39 | * calls specify the same orderingCtx
object they
40 | * are executed in the order the calls are made. Two calls that
41 | * specify different values for the orderingCtx
42 | * parameter can have their runnables executed in any order.
43 | * @param promise a promise which is to be completed when the runnable has finished
44 | * executing.
45 | */
46 | void run(Runnable runnable, Object orderingCtx, Promisenull
50 | * then the SASL ANONYMOUS mechanism will be used instead.
51 | */
52 | String getUser();
53 |
54 | /**
55 | * @return the password to use as part of a SASL PLAIN flow used to
56 | * authenticate the client.
57 | */
58 | String getPassword();
59 |
60 | /**
61 | * @return the maximum idle period between activity (frames) on the
62 | * connection that the client desires from this endpoint.
63 | */
64 | int getIdleTimeout();
65 |
66 | /**
67 | * @return The URI for this endpoint, derived from the host and port,
68 | * and taking into account whether or not SSL/TLS is enabled.
69 | */
70 | URI getURI();
71 |
72 | /**
73 | * @return the required SSL/TLS options.
74 | */
75 | SSLOptions getSSLOptions();
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/endpoint/EndpointPromise.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api.endpoint;
20 |
21 | import com.ibm.mqlight.api.Promise;
22 |
23 | /**
24 | * A promise that is used to indicate the outcome of an endpoint lookup
25 | * operation. The inherited {@link Promise#setSuccess(Object)}
26 | * method is used when the lookup operation is successful and returns an
27 | * {@link Endpoint}. The inherited {@link Promise#setFailure(Exception)}
28 | * method is used when the lookup operation fails and the client should
29 | * transition into stopped state. The {@link EndpointPromise#setWait(long)}
30 | * method is used to indicate that the client should wait for a period of
31 | * time before making more endpoint lookup requests
32 | */
33 | public interface EndpointPromise extends Promise
36 | * When the operation completes the promise (supplied as an argument) is used to
37 | * notify the client of the outcome. If an endpoint is available it will be
38 | * supplied to the {@link Promise#setSuccess(Object)} method. If no
39 | * endpoints are currently available, the client can be advised to wait for a
40 | * period of time before calling this method again using the {@link EndpointPromise#setWait(long)}
41 | * method. Indicating failure by calling the {@link EndpointPromise#setFailure(Exception)}
42 | * will cause the client to transition into
36 | * The action is invoked whenever a connection is recovered.
37 | */
38 | void remakeInboundLinks();
39 |
40 | void blessEndpoint();
41 |
42 | /**
43 | * This action performs the cleanup operations such as flushing/failing any pending sends or subscribes.
44 | *
45 | * The action can be invoked when a client is stopping.
46 | */
47 | void cleanup();
48 |
49 | void failPendingStops();
50 |
51 | void succeedPendingStops();
52 |
53 | void failPendingStarts();
54 |
55 | void succeedPendingStarts();
56 |
57 | // All of these relate to external state machine transitions
58 | void eventStarting();
59 | void eventUserStopping();
60 | void eventSystemStopping();
61 | void eventStopped();
62 | void eventStarted();
63 | void eventRetrying();
64 | void eventRestarted();
65 |
66 | /**
67 | * This action breaks any pending sends and subscription requests from the client
68 | *
69 | * The action is invoked whenever a network error occurs and the client is not stopping.
70 | */
71 | void breakInboundLinks();
72 |
73 | void processQueuedActions();
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/impl/InternalSend.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api.impl;
20 |
21 | import io.netty.buffer.ByteBuf;
22 |
23 | import com.ibm.mqlight.api.QOS;
24 | import com.ibm.mqlight.api.logging.Logger;
25 | import com.ibm.mqlight.api.logging.LoggerFactory;
26 |
27 | class InternalSendstopped
state.
43 | *
44 | * @param promise a promise that is to be completed when the endpoint service has
45 | * completed the lookup request.
46 | */
47 | void lookup(EndpointPromise promise);
48 |
49 | /**
50 | * Called by the client when it has successfully established a connection to one of
51 | * the endpoints returned by this service. This allows the endpoint service to
52 | * optimise the order in which it returns endpoints (for example to implement an
53 | * algorithm that always returns the most recently successful endpoints first).
54 | *
55 | * @param endpoint the endpoint to which a connection has successfully being established.
56 | */
57 | void onSuccess(Endpoint endpoint);
58 | }
59 |
--------------------------------------------------------------------------------
/mqlight/src/main/java/com/ibm/mqlight/api/impl/BytesDeliveryImpl.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | package com.ibm.mqlight.api.impl;
20 |
21 | import java.nio.ByteBuffer;
22 | import java.util.Map;
23 |
24 | import com.ibm.mqlight.api.BytesDelivery;
25 | import com.ibm.mqlight.api.QOS;
26 | import com.ibm.mqlight.api.impl.engine.DeliveryRequest;
27 |
28 | class BytesDeliveryImpl extends DeliveryImpl implements BytesDelivery {
29 |
30 | private final ByteBuffer data;
31 |
32 | protected BytesDeliveryImpl(NonBlockingClientImpl client, QOS qos, String shareName, String topic,
33 | String topicPattern, long ttl, ByteBuffer data, Map