http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ClusterTopologyListener.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ClusterTopologyListener.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ClusterTopologyListener.java new file mode 100644 index 0000000..f765852 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ClusterTopologyListener.java @@ -0,0 +1,40 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +/** + * A cluster topology listener. + * <p> + * Used to get notification of topology events. After adding a listener to the cluster connection, + * the listener receives {@link #nodeUP(TopologyMember, boolean)} for all the current topology + * members. + * @author tim + */ +public interface ClusterTopologyListener +{ + /** + * Triggered when a node joins the cluster. + * @param member + * @param last if the whole cluster topology is being transmitted (after adding the listener to + * the cluster connection) this parameter will be {@code true} for the last topology + * member. + */ + void nodeUP(TopologyMember member, boolean last); + + /** + * Triggered when a node leaves the cluster. + * @param eventUID + * @param nodeID the id of the node leaving the cluster + */ + void nodeDown(long eventUID, String nodeID); +}
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventListener.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventListener.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventListener.java new file mode 100644 index 0000000..5dd4a4c --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventListener.java @@ -0,0 +1,30 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +/** + * A FailoverEvent notifies the client the state if the connection changes occurred on the session. + * + * @author <a href="mailto:[email protected]">Flemming Harms</a> + */ +public interface FailoverEventListener +{ + /** + * Notifies that a connection state has changed according the specified event type. <br> + * This method is called when failover is detected, if it fails and when it's completed + * + * @param eventType The type of event + */ + void failoverEvent(FailoverEventType eventType); + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventType.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventType.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventType.java new file mode 100644 index 0000000..69acf6f --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/FailoverEventType.java @@ -0,0 +1,20 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +public enum FailoverEventType +{ + FAILURE_DETECTED, + FAILOVER_COMPLETED, + FAILOVER_FAILED; +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/HornetQClient.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/HornetQClient.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/HornetQClient.java new file mode 100644 index 0000000..64576a1 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/HornetQClient.java @@ -0,0 +1,209 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +import org.apache.activemq6.api.config.HornetQDefaultConfiguration; +import org.apache.activemq6.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq6.api.core.TransportConfiguration; +import org.apache.activemq6.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy; +import org.apache.activemq6.core.client.impl.ServerLocatorImpl; + +/** + * Utility class for creating HornetQ {@link ClientSessionFactory} objects. + * <p> + * Once a {@link ClientSessionFactory} has been created, it can be further configured using its + * setter methods before creating the sessions. Once a session is created, the factory can no longer + * be modified (its setter methods will throw a {@link IllegalStateException}. + * @author <a href="mailto:[email protected]">Andy Taylor</a> + */ +public final class HornetQClient +{ + public static final String DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME = RoundRobinConnectionLoadBalancingPolicy.class.getCanonicalName(); + + public static final long DEFAULT_CLIENT_FAILURE_CHECK_PERIOD = HornetQDefaultConfiguration.getDefaultClientFailureCheckPeriod(); + + public static final long DEFAULT_CLIENT_FAILURE_CHECK_PERIOD_INVM = -1; + + // 1 minute - this should be higher than ping period + + public static final long DEFAULT_CONNECTION_TTL = HornetQDefaultConfiguration.getDefaultConnectionTtl(); + + public static final long DEFAULT_CONNECTION_TTL_INVM = -1; + + // Any message beyond this size is considered a large message (to be sent in chunks) + + public static final int DEFAULT_MIN_LARGE_MESSAGE_SIZE = 100 * 1024; + + public static final boolean DEFAULT_COMPRESS_LARGE_MESSAGES = false; + + public static final int DEFAULT_CONSUMER_WINDOW_SIZE = 1024 * 1024; + + public static final int DEFAULT_CONSUMER_MAX_RATE = -1; + + public static final int DEFAULT_CONFIRMATION_WINDOW_SIZE = -1; + + public static final int DEFAULT_PRODUCER_WINDOW_SIZE = 64 * 1024; + + public static final int DEFAULT_PRODUCER_MAX_RATE = -1; + + public static final boolean DEFAULT_BLOCK_ON_ACKNOWLEDGE = false; + + public static final boolean DEFAULT_BLOCK_ON_DURABLE_SEND = true; + + public static final boolean DEFAULT_BLOCK_ON_NON_DURABLE_SEND = false; + + public static final boolean DEFAULT_AUTO_GROUP = false; + + public static final long DEFAULT_CALL_TIMEOUT = 30000; + + public static final long DEFAULT_CALL_FAILOVER_TIMEOUT = -1; + + public static final int DEFAULT_ACK_BATCH_SIZE = 1024 * 1024; + + public static final boolean DEFAULT_PRE_ACKNOWLEDGE = false; + + public static final long DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT = 10000; + + public static final long DEFAULT_DISCOVERY_REFRESH_TIMEOUT = 10000; + + public static final int DEFAULT_DISCOVERY_PORT = 9876; + + public static final long DEFAULT_RETRY_INTERVAL = 2000; + + public static final double DEFAULT_RETRY_INTERVAL_MULTIPLIER = HornetQDefaultConfiguration.getDefaultRetryIntervalMultiplier(); + + public static final long DEFAULT_MAX_RETRY_INTERVAL = HornetQDefaultConfiguration.getDefaultMaxRetryInterval(); + + public static final int DEFAULT_RECONNECT_ATTEMPTS = 0; + + public static final int INITIAL_CONNECT_ATTEMPTS = 1; + + public static final boolean DEFAULT_FAILOVER_ON_INITIAL_CONNECTION = false; + + public static final boolean DEFAULT_IS_HA = false; + + public static final boolean DEFAULT_USE_GLOBAL_POOLS = true; + + public static final int DEFAULT_THREAD_POOL_MAX_SIZE = -1; + + public static final int DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE = 5; + + public static final boolean DEFAULT_CACHE_LARGE_MESSAGE_CLIENT = false; + + public static final int DEFAULT_INITIAL_MESSAGE_PACKET_SIZE = 1500; + + public static final boolean DEFAULT_XA = false; + + public static final boolean DEFAULT_HA = false; + + public static final String DEFAULT_CORE_PROTOCOL = "CORE"; + + /** + * Create a ServerLocator which creates session factories using a static list of transportConfigurations, the ServerLocator is not updated automatically + * as the cluster topology changes, and no HA backup information is propagated to the client + * + * @param transportConfigurations + * @return the ServerLocator + */ + public static ServerLocator createServerLocatorWithoutHA(TransportConfiguration... transportConfigurations) + { + return new ServerLocatorImpl(false, transportConfigurations); + } + + /** + * Create a ServerLocator which creates session factories using a static list of transportConfigurations, the ServerLocator is not updated automatically + * as the cluster topology changes, and no HA backup information is propagated to the client + * + * @param ha The Locator will support topology updates and ha (this required the server to be clustered, otherwise the first connection will timeout) + * @param transportConfigurations + * @return the ServerLocator + */ + public static ServerLocator createServerLocator(final boolean ha, TransportConfiguration... transportConfigurations) + { + return new ServerLocatorImpl(ha, transportConfigurations); + } + + /** + * Create a ServerLocator which creates session factories from a set of live servers, no HA + * backup information is propagated to the client + * <p> + * The UDP address and port are used to listen for live servers in the cluster + * @param groupConfiguration + * @return the ServerLocator + */ + public static ServerLocator createServerLocatorWithoutHA(final DiscoveryGroupConfiguration groupConfiguration) + { + return new ServerLocatorImpl(false, groupConfiguration); + } + + + /** + * Create a ServerLocator which creates session factories from a set of live servers, no HA + * backup information is propagated to the client The UDP address and port are used to listen for + * live servers in the cluster + * @param ha The Locator will support topology updates and ha (this required the server to be + * clustered, otherwise the first connection will timeout) + * @param groupConfiguration + * @return the ServerLocator + */ + public static ServerLocator createServerLocator(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration) + { + return new ServerLocatorImpl(ha, groupConfiguration); + } + + /** + * Create a ServerLocator which will receive cluster topology updates from the cluster as servers + * leave or join and new backups are appointed or removed. + * <p> + * The initial list of servers supplied in this method is simply to make an initial connection to + * the cluster, once that connection is made, up to date cluster topology information is + * downloaded and automatically updated whenever the cluster topology changes. + * <p> + * If the topology includes backup servers that information is also propagated to the client so + * that it can know which server to failover onto in case of live server failure. + * @param initialServers The initial set of servers used to make a connection to the cluster. + * Each one is tried in turn until a successful connection is made. Once a connection + * is made, the cluster topology is downloaded and the rest of the list is ignored. + * @return the ServerLocator + */ + public static ServerLocator createServerLocatorWithHA(TransportConfiguration... initialServers) + { + return new ServerLocatorImpl(true, initialServers); + } + + /** + * Create a ServerLocator which will receive cluster topology updates from the cluster as servers + * leave or join and new backups are appointed or removed. + * <p> + * The discoveryAddress and discoveryPort parameters in this method are used to listen for UDP + * broadcasts which contain connection information for members of the cluster. The broadcasted + * connection information is simply used to make an initial connection to the cluster, once that + * connection is made, up to date cluster topology information is downloaded and automatically + * updated whenever the cluster topology changes. + * <p> + * If the topology includes backup servers that information is also propagated to the client so + * that it can know which server to failover onto in case of live server failure. + * @param groupConfiguration + * @return the ServerLocator + */ + public static ServerLocator createServerLocatorWithHA(final DiscoveryGroupConfiguration groupConfiguration) + { + return new ServerLocatorImpl(true, groupConfiguration); + } + + + private HornetQClient() + { + // Utility class + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/MessageHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/MessageHandler.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/MessageHandler.java new file mode 100644 index 0000000..7a8657c --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/MessageHandler.java @@ -0,0 +1,31 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +/** + * A MessageHandler is used to receive message <em>asynchronously</em>. + * <p> + * To receive messages asynchronously, a MessageHandler is set on a ClientConsumer. Every time the + * consumer will receive a message, it will call the handler's {@code onMessage()} method. + * @author <a href="mailto:[email protected]">Tim Fox</a> + * @see ClientConsumer#setMessageHandler(MessageHandler) + */ +public interface MessageHandler +{ + /** + * Notifies the MessageHandler that a message has been received. + * + * @param message a message + */ + void onMessage(ClientMessage message); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SendAcknowledgementHandler.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SendAcknowledgementHandler.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SendAcknowledgementHandler.java new file mode 100644 index 0000000..0c4780a --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SendAcknowledgementHandler.java @@ -0,0 +1,41 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +import org.apache.activemq6.api.core.Message; + +/** + * A SendAcknowledgementHandler notifies a client when an message sent asynchronously has been + * received by the server. + * <p> + * If the session is not blocking when sending durable or non-durable messages, the session can set + * a SendAcknowledgementHandler to be notified later when the messages has been received by the + * server. The method {@link #sendAcknowledged(Message)} will be called with the message that was + * sent asynchronously. + * <p> + * The rate of notification can be controlled through + * {@link ServerLocator#setConfirmationWindowSize(int)}. + * <p> + * Notice that this notification will only take place if {@code ConfirmationWindowSize} is set to a + * positive value at {@link ServerLocator#setConfirmationWindowSize(int)}. + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public interface SendAcknowledgementHandler +{ + /** + * Notifies the client that a message sent asynchronously has been received by the server. + * + * @param message message sent asynchronously + */ + void sendAcknowledged(Message message); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ServerLocator.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ServerLocator.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ServerLocator.java new file mode 100644 index 0000000..03b12b8 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/ServerLocator.java @@ -0,0 +1,790 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +import org.apache.activemq6.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq6.api.core.Interceptor; +import org.apache.activemq6.api.core.TransportConfiguration; +import org.apache.activemq6.core.client.impl.Topology; +import org.apache.activemq6.spi.core.remoting.ClientProtocolManagerFactory; + +/** + * The serverLocator locates a server, but beyond that it locates a server based on a list. + * <p> + * If you are using straight TCP on the configuration, and if you configure your serverLocator to be + * HA, the locator will always get an updated list of members to the server, the server will send + * the updated list to the client. + * <p> + * If you use UDP or JGroups (exclusively JGroups or UDP), the initial discovery is done by the + * grouping finder, after the initial connection is made the server will always send updates to the + * client. But the listeners will listen for updates on grouping. + * + * @author Tim Fox + */ +public interface ServerLocator extends AutoCloseable +{ + + /** + * Returns true if close was already called + * + * @return {@code true} if closed, {@code false} otherwise. + */ + boolean isClosed(); + + /** + * This method will disable any checks when a GarbageCollection happens + * leaving connections open. The JMS Layer will make specific usage of this + * method, since the ConnectionFactory.finalize should release this. + * <p> + * Warning: You may leave resources unattended if you call this method and + * don't take care of cleaning the resources yourself. + */ + void disableFinalizeCheck(); + + /** + * Creates a ClientSessionFactory using whatever load balancing policy is in force + * + * @return The ClientSessionFactory + * @throws Exception + */ + ClientSessionFactory createSessionFactory() throws Exception; + + /** + * Creates a {@link ClientSessionFactory} to a specific server. The server must already be known + * about by this ServerLocator. This method allows the user to make a connection to a specific + * server bypassing any load balancing policy in force + * + * @param nodeID + * @return a ClientSessionFactory instance or {@code null} if the node is not present on the + * topology + * @throws Exception if a failure happened in creating the ClientSessionFactory or the + * ServerLocator does not know about the passed in transportConfiguration + */ + ClientSessionFactory createSessionFactory(final String nodeID) throws Exception; + + /** + * Creates a {@link ClientSessionFactory} to a specific server. The server must already be known + * about by this ServerLocator. This method allows the user to make a connection to a specific + * server bypassing any load balancing policy in force + * + * @param transportConfiguration + * @return a {@link ClientSessionFactory} instance + * @throws Exception if a failure happened in creating the ClientSessionFactory or the + * ServerLocator does not know about the passed in transportConfiguration + */ + ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception; + + /** + * Creates a {@link ClientSessionFactory} to a specific server. The server must already be known + * about by this ServerLocator. This method allows the user to make a connection to a specific + * server bypassing any load balancing policy in force + * + * @param transportConfiguration + * @param reconnectAttempts number of attempts of reconnection to perform + * @param failoverOnInitialConnection + * @return a {@link ClientSessionFactory} instance + * @throws Exception if a failure happened in creating the ClientSessionFactory or the + * ServerLocator does not know about the passed in transportConfiguration + */ + ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration, int reconnectAttempts, boolean failoverOnInitialConnection) throws Exception; + + /** + * Returns the period used to check if a client has failed to receive pings from the server. + * <p> + * Period is in milliseconds, default value is + * {@link HornetQClient#DEFAULT_CLIENT_FAILURE_CHECK_PERIOD}. + * + * @return the period used to check if a client has failed to receive pings from the server + */ + long getClientFailureCheckPeriod(); + + /** + * Sets the period (in milliseconds) used to check if a client has failed to receive pings from + * the server. + * <p> + * Value must be -1 (to disable) or greater than 0. + * + * @param clientFailureCheckPeriod the period to check failure + * @return this ServerLocator + */ + ServerLocator setClientFailureCheckPeriod(long clientFailureCheckPeriod); + + /** + * When <code>true</code>, consumers created through this factory will create temporary files to + * cache large messages. + * <p> + * There is 1 temporary file created for each large message. + * <p> + * Default value is {@link HornetQClient#DEFAULT_CACHE_LARGE_MESSAGE_CLIENT}. + * + * @return <code>true</code> if consumers created through this factory will cache large messages + * in temporary files, <code>false</code> else + */ + boolean isCacheLargeMessagesClient(); + + /** + * Sets whether large messages received by consumers created through this factory will be cached in temporary files or not. + * + * @param cached <code>true</code> to cache large messages in temporary files, <code>false</code> else + * @return this ServerLocator + */ + ServerLocator setCacheLargeMessagesClient(boolean cached); + + /** + * Returns the connection <em>time-to-live</em>. + * <p> + * This TTL determines how long the server will keep a connection alive in the absence of any + * data arriving from the client. Value is in milliseconds, default value is + * {@link HornetQClient#DEFAULT_CONNECTION_TTL}. + * + * @return the connection time-to-live in milliseconds + */ + long getConnectionTTL(); + + /** + * Sets this factory's connections <em>time-to-live</em>. + * <p> + * Value must be -1 (to disable) or greater or equals to 0. + * + * @param connectionTTL period in milliseconds + * @return this ServerLocator + */ + ServerLocator setConnectionTTL(long connectionTTL); + + /** + * Returns the blocking calls timeout. + * <p> + * If client's blocking calls to the server take more than this timeout, the call will throw a + * {@link org.apache.activemq6.api.core.HornetQException} with the code {@link org.hornetq.api.core.HornetQExceptionType#CONNECTION_TIMEDOUT}. Value + * is in milliseconds, default value is {@link HornetQClient#DEFAULT_CALL_TIMEOUT}. + * + * @return the blocking calls timeout + */ + long getCallTimeout(); + + /** + * Sets the blocking call timeout. + * <p> + * Value must be greater or equals to 0 + * + * @param callTimeout blocking call timeout in milliseconds + * @return this ServerLocator + */ + ServerLocator setCallTimeout(long callTimeout); + + + /** + * Returns the blocking calls failover timeout when the client is awaiting failover, + * this is over and above the normal call timeout. + * <p> + * If client is in the process of failing over when a blocking call is called then the client will wait this long before + * actually trying the send. + * + * @return the blocking calls failover timeout + */ + long getCallFailoverTimeout(); + + /** + * Sets the blocking call failover timeout. + * <p> + * When the client is awaiting failover, this is over and above the normal call timeout. + * <p> + * Value must be greater or equals to -1, -1 means forever + * + * @param callFailoverTimeout blocking call timeout in milliseconds + * @return this ServerLocator + */ + ServerLocator setCallFailoverTimeout(long callFailoverTimeout); + + /** + * Returns the large message size threshold. + * <p> + * Messages whose size is if greater than this value will be handled as <em>large messages</em>. + * Value is in bytes, default value is {@link HornetQClient#DEFAULT_MIN_LARGE_MESSAGE_SIZE}. + * + * @return the message size threshold to treat messages as large messages. + */ + int getMinLargeMessageSize(); + + /** + * Sets the large message size threshold. + * <p> + * Value must be greater than 0. + * + * @param minLargeMessageSize large message size threshold in bytes + * @return this ServerLocator + */ + ServerLocator setMinLargeMessageSize(int minLargeMessageSize); + + /** + * Returns the window size for flow control of the consumers created through this factory. + * <p> + * Value is in bytes, default value is {@link HornetQClient#DEFAULT_CONSUMER_WINDOW_SIZE}. + * + * @return the window size used for consumer flow control + */ + int getConsumerWindowSize(); + + /** + * Sets the window size for flow control of the consumers created through this factory. + * <p> + * Value must be -1 (to disable flow control), 0 (to not buffer any messages) or greater than 0 + * (to set the maximum size of the buffer) + * + * @param consumerWindowSize window size (in bytes) used for consumer flow control + * @return this ServerLocator + */ + ServerLocator setConsumerWindowSize(int consumerWindowSize); + + /** + * Returns the maximum rate of message consumption for consumers created through this factory. + * <p> + * This value controls the rate at which a consumer can consume messages. A consumer will never consume messages at a rate faster than the rate specified. + * <p> + * Value is -1 (to disable) or a positive integer corresponding to the maximum desired message consumption rate specified in units of messages per second. + * Default value is {@link HornetQClient#DEFAULT_CONSUMER_MAX_RATE}. + * + * @return the consumer max rate + */ + int getConsumerMaxRate(); + + /** + * Sets the maximum rate of message consumption for consumers created through this factory. + * <p> + * Value must -1 (to disable) or a positive integer corresponding to the maximum desired message consumption rate specified in units of messages per second. + * + * @param consumerMaxRate maximum rate of message consumption (in messages per seconds) + * @return this ServerLocator + */ + ServerLocator setConsumerMaxRate(int consumerMaxRate); + + /** + * Returns the size for the confirmation window of clients using this factory. + * <p> + * Value is in bytes or -1 (to disable the window). Default value is + * {@link HornetQClient#DEFAULT_CONFIRMATION_WINDOW_SIZE}. + * + * @return the size for the confirmation window of clients using this factory + */ + int getConfirmationWindowSize(); + + /** + * Sets the size for the confirmation window buffer of clients using this factory. + * <p> + * Value must be -1 (to disable the window) or greater than 0. + * + * @param confirmationWindowSize size of the confirmation window (in bytes) + * @return this ServerLocator + */ + ServerLocator setConfirmationWindowSize(int confirmationWindowSize); + + /** + * Returns the window size for flow control of the producers created through this factory. + * <p> + * Value must be -1 (to disable flow control) or greater than 0 to determine the maximum amount of bytes at any give time (to prevent overloading the connection). + * Default value is {@link HornetQClient#DEFAULT_PRODUCER_WINDOW_SIZE}. + * + * @return the window size for flow control of the producers created through this factory. + */ + int getProducerWindowSize(); + + /** + * Returns the window size for flow control of the producers created through this factory. + * <p> + * Value must be -1 (to disable flow control) or greater than 0. + * + * @param producerWindowSize window size (in bytest) for flow control of the producers created through this factory. + * @return this ServerLocator + */ + ServerLocator setProducerWindowSize(int producerWindowSize); + + /** + * Returns the maximum rate of message production for producers created through this factory. + * <p> + * This value controls the rate at which a producer can produce messages. A producer will never produce messages at a rate faster than the rate specified. + * <p> + * Value is -1 (to disable) or a positive integer corresponding to the maximum desired message production rate specified in units of messages per second. + * Default value is {@link HornetQClient#DEFAULT_PRODUCER_MAX_RATE}. + * + * @return maximum rate of message production (in messages per seconds) + */ + int getProducerMaxRate(); + + /** + * Sets the maximum rate of message production for producers created through this factory. + * <p> + * Value must -1 (to disable) or a positive integer corresponding to the maximum desired message production rate specified in units of messages per second. + * + * @param producerMaxRate maximum rate of message production (in messages per seconds) + * @return this ServerLocator + */ + ServerLocator setProducerMaxRate(int producerMaxRate); + + /** + * Returns whether consumers created through this factory will block while + * sending message acknowledgments or do it asynchronously. + * <p> + * Default value is {@link HornetQClient#DEFAULT_BLOCK_ON_ACKNOWLEDGE}. + * + * @return whether consumers will block while sending message + * acknowledgments or do it asynchronously + */ + boolean isBlockOnAcknowledge(); + + /** + * Sets whether consumers created through this factory will block while + * sending message acknowledgments or do it asynchronously. + * + * @param blockOnAcknowledge <code>true</code> to block when sending message + * acknowledgments or <code>false</code> to send them + * asynchronously + * @return this ServerLocator + */ + ServerLocator setBlockOnAcknowledge(boolean blockOnAcknowledge); + + /** + * Returns whether producers created through this factory will block while sending <em>durable</em> messages or do it asynchronously. + * <br> + * If the session is configured to send durable message asynchronously, the client can set a SendAcknowledgementHandler on the ClientSession + * to be notified once the message has been handled by the server. + * <p> + * Default value is {@link HornetQClient#DEFAULT_BLOCK_ON_DURABLE_SEND}. + * + * @return whether producers will block while sending persistent messages or do it asynchronously + */ + boolean isBlockOnDurableSend(); + + /** + * Sets whether producers created through this factory will block while sending <em>durable</em> messages or do it asynchronously. + * + * @param blockOnDurableSend <code>true</code> to block when sending durable messages or <code>false</code> to send them asynchronously + * @return this ServerLocator + */ + ServerLocator setBlockOnDurableSend(boolean blockOnDurableSend); + + /** + * Returns whether producers created through this factory will block while sending <em>non-durable</em> messages or do it asynchronously. + * <br> + * If the session is configured to send non-durable message asynchronously, the client can set a SendAcknowledgementHandler on the ClientSession + * to be notified once the message has been handled by the server. + * <p> + * Default value is {@link HornetQClient#DEFAULT_BLOCK_ON_NON_DURABLE_SEND}. + * + * @return whether producers will block while sending non-durable messages or do it asynchronously + */ + boolean isBlockOnNonDurableSend(); + + /** + * Sets whether producers created through this factory will block while sending <em>non-durable</em> messages or do it asynchronously. + * + * @param blockOnNonDurableSend <code>true</code> to block when sending non-durable messages or <code>false</code> to send them asynchronously + * @return this ServerLocator + */ + ServerLocator setBlockOnNonDurableSend(boolean blockOnNonDurableSend); + + /** + * Returns whether producers created through this factory will automatically + * assign a group ID to the messages they sent. + * <p> + * if <code>true</code>, a random unique group ID is created and set on each message for the property + * {@link org.apache.activemq6.api.core.Message#HDR_GROUP_ID}. + * Default value is {@link HornetQClient#DEFAULT_AUTO_GROUP}. + * + * @return whether producers will automatically assign a group ID to their messages + */ + boolean isAutoGroup(); + + /** + * Sets whether producers created through this factory will automatically + * assign a group ID to the messages they sent. + * + * @param autoGroup <code>true</code> to automatically assign a group ID to each messages sent through this factory, <code>false</code> else + * @return this ServerLocator + */ + ServerLocator setAutoGroup(boolean autoGroup); + + /** + * Returns the group ID that will be eventually set on each message for the property {@link org.apache.activemq6.api.core.Message#HDR_GROUP_ID}. + * <p> + * Default value is is {@code null} and no group ID will be set on the messages. + * + * @return the group ID that will be eventually set on each message + */ + String getGroupID(); + + /** + * Sets the group ID that will be set on each message sent through this factory. + * + * @param groupID the group ID to use + * @return this ServerLocator + */ + ServerLocator setGroupID(String groupID); + + /** + * Returns whether messages will pre-acknowledged on the server before they are sent to the consumers or not. + * <p> + * Default value is {@link HornetQClient#DEFAULT_PRE_ACKNOWLEDGE} + */ + boolean isPreAcknowledge(); + + /** + * Sets to <code>true</code> to pre-acknowledge consumed messages on the + * server before they are sent to consumers, else set to <code>false</code> + * to let clients acknowledge the message they consume. + * + * @param preAcknowledge <code>true</code> to enable pre-acknowledgment, + * <code>false</code> else + * @return this ServerLocator + */ + ServerLocator setPreAcknowledge(boolean preAcknowledge); + + /** + * Returns the acknowledgments batch size. + * <p> + * Default value is {@link HornetQClient#DEFAULT_ACK_BATCH_SIZE}. + * + * @return the acknowledgments batch size + */ + int getAckBatchSize(); + + /** + * Sets the acknowledgments batch size. + * <p> + * Value must be equal or greater than 0. + * + * @param ackBatchSize acknowledgments batch size + * @return this ServerLocator + */ + ServerLocator setAckBatchSize(int ackBatchSize); + + /** + * Returns an array of TransportConfigurations representing the static list of live servers used + * when creating this object + * + * @return array with all static {@link TransportConfiguration}s + */ + TransportConfiguration[] getStaticTransportConfigurations(); + + /** + * The discovery group configuration + */ + DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(); + + /** + * Returns whether this factory will use global thread pools (shared among all the factories in the same JVM) + * or its own pools. + * <p> + * Default value is {@link HornetQClient#DEFAULT_USE_GLOBAL_POOLS}. + * + * @return <code>true</code> if this factory uses global thread pools, <code>false</code> else + */ + boolean isUseGlobalPools(); + + /** + * Sets whether this factory will use global thread pools (shared among all the factories in the same JVM) + * or its own pools. + * + * @param useGlobalPools <code>true</code> to let this factory uses global thread pools, <code>false</code> else + * @return this ServerLocator + */ + ServerLocator setUseGlobalPools(boolean useGlobalPools); + + /** + * Returns the maximum size of the scheduled thread pool. + * <p> + * Default value is {@link HornetQClient#DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE}. + * + * @return the maximum size of the scheduled thread pool. + */ + int getScheduledThreadPoolMaxSize(); + + /** + * Sets the maximum size of the scheduled thread pool. + * <p> + * This setting is relevant only if this factory does not use global pools. + * Value must be greater than 0. + * + * @param scheduledThreadPoolMaxSize maximum size of the scheduled thread pool. + * @return this ServerLocator + */ + ServerLocator setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize); + + /** + * Returns the maximum size of the thread pool. + * <p> + * Default value is {@link HornetQClient#DEFAULT_THREAD_POOL_MAX_SIZE}. + * + * @return the maximum size of the thread pool. + */ + int getThreadPoolMaxSize(); + + /** + * Sets the maximum size of the thread pool. + * <p> + * This setting is relevant only if this factory does not use global pools. + * Value must be -1 (for unlimited thread pool) or greater than 0. + * + * @param threadPoolMaxSize maximum size of the thread pool. + * @return this ServerLocator + */ + ServerLocator setThreadPoolMaxSize(int threadPoolMaxSize); + + /** + * Returns the time to retry connections created by this factory after failure. + * <p> + * Value is in milliseconds, default is {@link HornetQClient#DEFAULT_RETRY_INTERVAL}. + * + * @return the time to retry connections created by this factory after failure + */ + long getRetryInterval(); + + /** + * Sets the time to retry connections created by this factory after failure. + * <p> + * Value must be greater than 0. + * + * @param retryInterval time (in milliseconds) to retry connections created by this factory after failure + * @return this ServerLocator + */ + ServerLocator setRetryInterval(long retryInterval); + + /** + * Returns the multiplier to apply to successive retry intervals. + * <p> + * Default value is {@link HornetQClient#DEFAULT_RETRY_INTERVAL_MULTIPLIER}. + * + * @return the multiplier to apply to successive retry intervals + */ + double getRetryIntervalMultiplier(); + + /** + * Sets the multiplier to apply to successive retry intervals. + * <p> + * Value must be positive. + * + * @param retryIntervalMultiplier multiplier to apply to successive retry intervals + * @return this ServerLocator + */ + ServerLocator setRetryIntervalMultiplier(double retryIntervalMultiplier); + + /** + * Returns the maximum retry interval (in the case a retry interval multiplier has been specified). + * <p> + * Value is in milliseconds, default value is {@link HornetQClient#DEFAULT_MAX_RETRY_INTERVAL}. + * + * @return the maximum retry interval + */ + long getMaxRetryInterval(); + + /** + * Sets the maximum retry interval. + * <p> + * Value must be greater than 0. + * + * @param maxRetryInterval maximum retry interval to apply in the case a retry interval multiplier + * has been specified + * @return this ServerLocator + */ + ServerLocator setMaxRetryInterval(long maxRetryInterval); + + /** + * Returns the maximum number of attempts to retry connection in case of failure. + * <p> + * Default value is {@link HornetQClient#DEFAULT_RECONNECT_ATTEMPTS}. + * + * @return the maximum number of attempts to retry connection in case of failure. + */ + int getReconnectAttempts(); + + /** + * Sets the maximum number of attempts to retry connection in case of failure. + * <p> + * Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0. + * + * @param reconnectAttempts maximum number of attempts to retry connection in case of failure + * @return this ServerLocator + */ + ServerLocator setReconnectAttempts(int reconnectAttempts); + + /** + * Sets the maximum number of attempts to establish an initial connection. + * <p> + * Value must be -1 (to retry infinitely), 0 (to never retry connection) or greater than 0. + * + * @param reconnectAttempts maximum number of attempts for the initial connection + * @return this ServerLocator + */ + ServerLocator setInitialConnectAttempts(int reconnectAttempts); + + /** + * @return the number of attempts to be made for first initial connection. + */ + int getInitialConnectAttempts(); + + /** + * Returns true if the client will automatically attempt to connect to the backup server if the initial + * connection to the live server fails + * <p> + * Default value is {@link HornetQClient#DEFAULT_FAILOVER_ON_INITIAL_CONNECTION}. + */ + boolean isFailoverOnInitialConnection(); + + /** + * Sets the value for FailoverOnInitialReconnection + * + * @param failover + * @return this ServerLocator + */ + ServerLocator setFailoverOnInitialConnection(boolean failover); + + /** + * Returns the class name of the connection load balancing policy. + * <p> + * Default value is "org.apache.activemq6.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy". + * + * @return the class name of the connection load balancing policy + */ + String getConnectionLoadBalancingPolicyClassName(); + + /** + * Sets the class name of the connection load balancing policy. + * <p> + * Value must be the name of a class implementing {@link org.apache.activemq6.api.core.client.loadbalance.ConnectionLoadBalancingPolicy}. + * + * @param loadBalancingPolicyClassName class name of the connection load balancing policy + * @return this ServerLocator + */ + ServerLocator setConnectionLoadBalancingPolicyClassName(String loadBalancingPolicyClassName); + + /** + * Returns the initial size of messages created through this factory. + * <p> + * Value is in bytes, default value is {@link HornetQClient#DEFAULT_INITIAL_MESSAGE_PACKET_SIZE}. + * + * @return the initial size of messages created through this factory + */ + int getInitialMessagePacketSize(); + + /** + * Sets the initial size of messages created through this factory. + * <p> + * Value must be greater than 0. + * + * @param size initial size of messages created through this factory. + * @return this ServerLocator + */ + ServerLocator setInitialMessagePacketSize(int size); + + /** + * Adds an interceptor which will be executed <em>after packets are received from the server</em>. Invoking this + * method is the same as invoking <code>addIncomingInterceptor(Interceptor).</code> + * + * @param interceptor an Interceptor + * @deprecated As of HornetQ 2.3.0.Final, replaced by + * {@link #addIncomingInterceptor(Interceptor)} and + * {@link #addOutgoingInterceptor(Interceptor)} + */ + @Deprecated + void addInterceptor(Interceptor interceptor); + + /** + * Adds an interceptor which will be executed <em>after packets are received from the server</em>. + * + * @param interceptor an Interceptor + * @return this ServerLocator + */ + ServerLocator addIncomingInterceptor(Interceptor interceptor); + + /** + * Adds an interceptor which will be executed <em>before packets are sent to the server</em>. + * + * @param interceptor an Interceptor + * @return this ServerLocator + */ + ServerLocator addOutgoingInterceptor(Interceptor interceptor); + + /** + * Removes an interceptor. Invoking this method is the same as invoking + * <code>removeIncomingInterceptor(Interceptor).</code> + * + * @param interceptor interceptor to remove + * @return <code>true</code> if the interceptor is removed from this factory, <code>false</code> else + * @deprecated As of HornetQ 2.3.0.Final, replaced by + * {@link #removeIncomingInterceptor(Interceptor)} and + * {@link #removeOutgoingInterceptor(Interceptor)} + */ + @Deprecated + boolean removeInterceptor(Interceptor interceptor); + + /** + * Removes an incoming interceptor. + * + * @param interceptor interceptor to remove + * @return <code>true</code> if the incoming interceptor is removed from this factory, <code>false</code> else + */ + boolean removeIncomingInterceptor(Interceptor interceptor); + + /** + * Removes an outgoing interceptor. + * + * @param interceptor interceptor to remove + * @return <code>true</code> if the outgoing interceptor is removed from this factory, <code>false</code> else + */ + boolean removeOutgoingInterceptor(Interceptor interceptor); + + /** + * Closes this factory and release all its resources + */ + void close(); + + /** + * Exposes the Topology used by this ServerLocator. + * + * @return topology + */ + Topology getTopology(); + + /** + * Whether this server receives topology notifications from the cluster as servers join or leave + * the cluster. + * + * @return {@code true} if the locator receives topology updates from the cluster + */ + boolean isHA(); + + /** + * Whether to compress large messages. + * + * @return + */ + boolean isCompressLargeMessage(); + + /** + * Sets whether to compress or not large messages. + * + * @param compressLargeMessages + * @return this ServerLocator + */ + ServerLocator setCompressLargeMessage(boolean compressLargeMessages); + + // XXX No javadocs + ServerLocator addClusterTopologyListener(ClusterTopologyListener listener); + + // XXX No javadocs + void removeClusterTopologyListener(ClusterTopologyListener listener); + + ClientProtocolManagerFactory getProtocolManagerFactory(); + + void setProtocolManagerFactory(ClientProtocolManagerFactory protocolManager); + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SessionFailureListener.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SessionFailureListener.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SessionFailureListener.java new file mode 100644 index 0000000..82b317d --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/SessionFailureListener.java @@ -0,0 +1,33 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client; + +import org.apache.activemq6.api.core.HornetQException; +import org.apache.activemq6.core.remoting.FailureListener; + +/** + * A SessionFailureListener notifies the client when a failure occurred on the session. + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public interface SessionFailureListener extends FailureListener +{ + /** + * Notifies that a connection has failed due to the specified exception. + * <br> + * This method is called <em>before the session attempts to reconnect/failover</em>. + * + * @param exception exception which has caused the connection to fail + */ + void beforeReconnect(HornetQException exception); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/TopologyMember.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/TopologyMember.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/TopologyMember.java new file mode 100644 index 0000000..4b442fd --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/TopologyMember.java @@ -0,0 +1,96 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +/** + * + */ +package org.apache.activemq6.api.core.client; + +import java.io.Serializable; + +import org.apache.activemq6.api.core.TransportConfiguration; +import org.apache.activemq6.spi.core.protocol.RemotingConnection; + +/** + * A member of the topology. + * <p> + * Each TopologyMember represents a single server and possibly any backup server that may take over + * its duties (using the nodeId of the original server). + */ +public interface TopologyMember extends Serializable +{ + /** + * Returns the {@code backup-group-name} of the live server and backup servers associated with + * Topology entry. + * <p> + * This is a server configuration value. A (remote) backup will only work with live servers that + * have a matching {@code backup-group-name}. + * <p> + * This value does not apply to "shared-storage" backup and live pairs. + * + * @return the {@code backup-group-name} + */ + String getBackupGroupName(); + + /** + * Returns the {@code scale-down-group-name} of the live server with this Topology entry. + * <p/> + * This is a server configuration value. a live server will only send its messages to another live server + * with matching {@code scale-down-group-name}. + * <p/> + * + * @return the {@code scale-down-group-name} + */ + String getScaleDownGroupName(); + + /** + * @return configuration relative to the live server + */ + TransportConfiguration getLive(); + + /** + * Returns the TransportConfiguration relative to the backup server if any. + * + * @return a {@link TransportConfiguration} for the backup, or null} if the live server has no + * backup server. + */ + TransportConfiguration getBackup(); + + /** + * Returns the nodeId of the server. + * + * @return the nodeId + */ + String getNodeId(); + + /** + * @return long value representing a unique event ID + */ + long getUniqueEventID(); + + /** + * Returns true if this TopologyMember is the target of this remoting connection + * + * @param connection + * @return + */ + boolean isMember(RemotingConnection connection); + + /** + * Returns true if this configuration is the target of this remoting connection + * + * @param configuration + * @return + */ + boolean isMember(TransportConfiguration configuration); + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/ConnectionLoadBalancingPolicy.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/ConnectionLoadBalancingPolicy.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/ConnectionLoadBalancingPolicy.java new file mode 100644 index 0000000..adac722 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/ConnectionLoadBalancingPolicy.java @@ -0,0 +1,28 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client.loadbalance; + +/** + * A ConnectionLoadBalancingPolicy defines a policy to load balance between connections. + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public interface ConnectionLoadBalancingPolicy +{ + /** + * Returns the selected index according to the policy implementation. + * + * @param max maximum position index that can be selected + */ + int select(int max); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/FirstElementConnectionLoadBalancingPolicy.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/FirstElementConnectionLoadBalancingPolicy.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/FirstElementConnectionLoadBalancingPolicy.java new file mode 100644 index 0000000..98f7c39 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/FirstElementConnectionLoadBalancingPolicy.java @@ -0,0 +1,33 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client.loadbalance; + + +/** + * A {@link FirstElementConnectionLoadBalancingPolicy#select(int)} always returns 0. + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + * Created 28 Nov 2008 10:56:59 + */ +public final class FirstElementConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy +{ + /** + * @param max param is ignored + * @return 0 + */ + public int select(final int max) + { + return 0; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomConnectionLoadBalancingPolicy.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomConnectionLoadBalancingPolicy.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomConnectionLoadBalancingPolicy.java new file mode 100644 index 0000000..3935c6f --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomConnectionLoadBalancingPolicy.java @@ -0,0 +1,35 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client.loadbalance; + +import org.apache.activemq6.utils.Random; + +/** + * {@link RandomConnectionLoadBalancingPolicy#select(int)} returns a (pseudo) random integer between + * {@code 0} (inclusive) and {@code max} (exclusive). + * @author <a href="mailto:[email protected]">Tim Fox</a> Created 28 Nov 2008 10:24:11 + */ +public final class RandomConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy +{ + private final Random random = new Random(); + + /** + * Returns a pseudo random number between {@code 0} (inclusive) and {@code max} exclusive. + * @param max the upper limit of the random number selection + * @see java.util.Random#nextInt(int) + */ + public int select(final int max) + { + return random.getRandom().nextInt(max); + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomStickyConnectionLoadBalancingPolicy.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomStickyConnectionLoadBalancingPolicy.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomStickyConnectionLoadBalancingPolicy.java new file mode 100644 index 0000000..ca304e2 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RandomStickyConnectionLoadBalancingPolicy.java @@ -0,0 +1,41 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client.loadbalance; + +import org.apache.activemq6.utils.Random; + +/** + * {@link RandomConnectionLoadBalancingPolicy#select(int)} chooses a the initial node randomly then subsequent requests return the same node + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + */ +public final class RandomStickyConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy +{ + private final Random random = new Random(); + + private int pos = -1; + + /** + * @see java.util.Random#nextInt(int) + */ + public int select(final int max) + { + if (pos == -1) + { + pos = random.getRandom().nextInt(max); + } + + return pos; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RoundRobinConnectionLoadBalancingPolicy.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RoundRobinConnectionLoadBalancingPolicy.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RoundRobinConnectionLoadBalancingPolicy.java new file mode 100644 index 0000000..49a40b7 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/RoundRobinConnectionLoadBalancingPolicy.java @@ -0,0 +1,63 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.client.loadbalance; + +import java.io.Serializable; + +import org.apache.activemq6.utils.Random; + +/** + * RoundRobinConnectionLoadBalancingPolicy corresponds to a round-robin load-balancing policy. + * + * <br> + * The first call to {@link #select(int)} will return a random integer between {@code 0} (inclusive) and {@code max} (exclusive). + * Subsequent calls will then return an integer in a round-robin fashion. + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + * Created 28 Nov 2008 10:21:08 + * + * + */ +public final class RoundRobinConnectionLoadBalancingPolicy implements ConnectionLoadBalancingPolicy, Serializable +{ + private static final long serialVersionUID = 7511196010141439559L; + + private final Random random = new Random(); + + private boolean first = true; + + private int pos; + + public int select(final int max) + { + if (first) + { + // We start on a random one + pos = random.getRandom().nextInt(max); + + first = false; + } + else + { + pos++; + + if (pos >= max) + { + pos = 0; + } + } + + return pos; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/package-info.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/package-info.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/package-info.java new file mode 100644 index 0000000..59f8e18 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/loadbalance/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +/** + * Client load-balancing API. + * <br> + * This package defines the policies supported by + * HornetQ to load-balance client connections across + * HornetQ servers. + */ +package org.apache.activemq6.api.core.client.loadbalance; + http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/package-info.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/package-info.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/package-info.java new file mode 100644 index 0000000..4468e36 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/client/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +/** + * Core Client Messaging API. + * <br> + * This package defines the API used by HornetQ clients to produce and consume messages. + */ +package org.apache.activemq6.api.core.client; + http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AcceptorControl.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AcceptorControl.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AcceptorControl.java new file mode 100644 index 0000000..753d443 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AcceptorControl.java @@ -0,0 +1,43 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.management; + +import java.util.Map; + +/** + * An AcceptorControl is used to manage Acceptors. + * + * @author <a href="[email protected]">Jeff Mesnil</a> + * + * @see Acceptor + */ +public interface AcceptorControl extends HornetQComponentControl +{ + /** + * Returns the name of the acceptor + */ + String getName(); + + /** + * Returns the class name of the AcceptorFactory implementation + * used by this acceptor. + * + * @see AcceptorFactory + */ + String getFactoryClassName(); + + /** + * Returns the parameters used to configure this acceptor + */ + Map<String, Object> getParameters(); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressControl.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressControl.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressControl.java new file mode 100644 index 0000000..29ad3ac --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressControl.java @@ -0,0 +1,77 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.management; + + +import javax.management.MBeanOperationInfo; + +/** + * An AddressControl is used to manage an address. + * + * @author <a href="mailto:[email protected]">Jeff Mesnil</a> + */ +public interface AddressControl +{ + /** + * Returns the managed address. + */ + String getAddress(); + + /** + * Returns the roles (name and permissions) associated to this address. + */ + Object[] getRoles() throws Exception; + + /** + * Returns the roles (name and permissions) associated to this address + * using JSON serialization. + * <br> + * Java objects can be recreated from JSON serialization using {@link RoleInfo#from(String)}. + */ + String getRolesAsJSON() throws Exception; + + + @Operation(desc = "returns the number of estimated bytes being used by the queue, used to control paging and blocking", + impact = MBeanOperationInfo.INFO) + long getAddressSize() throws Exception; + + @Operation(desc = "Returns the sum of messages on queues, including messages in delivery", + impact = MBeanOperationInfo.INFO) + long getNumberOfMessages() throws Exception; + + /** + * Returns the names of the queues bound to this address. + */ + String[] getQueueNames() throws Exception; + + /** + * Returns the number of pages used by this address. + */ + int getNumberOfPages() throws Exception; + + /** + * Returns whether this address is paging. + * @throws Exception + */ + boolean isPaging() throws Exception; + + /** + * Returns the number of bytes used by each page for this address. + */ + long getNumberOfBytesPerPage() throws Exception; + + /** + * Returns the names of all bindings (both queues and diverts) bound to this address + */ + String[] getBindingNames() throws Exception; +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressSettingsInfo.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressSettingsInfo.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressSettingsInfo.java new file mode 100644 index 0000000..5714c25 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/AddressSettingsInfo.java @@ -0,0 +1,206 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.management; + +import org.apache.activemq6.utils.json.JSONObject; + +/** + * A AddressSettingsInfo + * + * @author jmesnil + * + * + */ +// XXX no javadocs +public final class AddressSettingsInfo +{ + private final String addressFullMessagePolicy; + + private final long maxSizeBytes; + + private final int pageSizeBytes; + + private int pageCacheMaxSize; + + private final int maxDeliveryAttempts; + + private final double redeliveryMultiplier; + + private final long maxRedeliveryDelay; + + private final long redeliveryDelay; + + private final String deadLetterAddress; + + private final String expiryAddress; + + private final boolean lastValueQueue; + + private final long redistributionDelay; + + private final boolean sendToDLAOnNoRoute; + + private final long slowConsumerThreshold; + + private final long slowConsumerCheckPeriod; + + private final String slowConsumerPolicy; + + // Static -------------------------------------------------------- + + public static AddressSettingsInfo from(final String jsonString) throws Exception + { + JSONObject object = new JSONObject(jsonString); + return new AddressSettingsInfo(object.getString("addressFullMessagePolicy"), + object.getLong("maxSizeBytes"), + object.getInt("pageSizeBytes"), + object.getInt("pageCacheMaxSize"), + object.getInt("maxDeliveryAttempts"), + object.getLong("redeliveryDelay"), + object.getDouble("redeliveryMultiplier"), + object.getLong("maxRedeliveryDelay"), + object.getString("DLA"), + object.getString("expiryAddress"), + object.getBoolean("lastValueQueue"), + object.getLong("redistributionDelay"), + object.getBoolean("sendToDLAOnNoRoute"), + object.getLong("slowConsumerThreshold"), + object.getLong("slowConsumerCheckPeriod"), + object.getString("slowConsumerPolicy")); + } + + // Constructors -------------------------------------------------- + + public AddressSettingsInfo(String addressFullMessagePolicy, + long maxSizeBytes, + int pageSizeBytes, + int pageCacheMaxSize, + int maxDeliveryAttempts, + long redeliveryDelay, + double redeliveryMultiplier, + long maxRedeliveryDelay, + String deadLetterAddress, + String expiryAddress, + boolean lastValueQueue, + long redistributionDelay, + boolean sendToDLAOnNoRoute, + long slowConsumerThreshold, + long slowConsumerCheckPeriod, + String slowConsumerPolicy) + { + this.addressFullMessagePolicy = addressFullMessagePolicy; + this.maxSizeBytes = maxSizeBytes; + this.pageSizeBytes = pageSizeBytes; + this.pageCacheMaxSize = pageCacheMaxSize; + this.maxDeliveryAttempts = maxDeliveryAttempts; + this.redeliveryDelay = redeliveryDelay; + this.redeliveryMultiplier = redeliveryMultiplier; + this.maxRedeliveryDelay = maxRedeliveryDelay; + this.deadLetterAddress = deadLetterAddress; + this.expiryAddress = expiryAddress; + this.lastValueQueue = lastValueQueue; + this.redistributionDelay = redistributionDelay; + this.sendToDLAOnNoRoute = sendToDLAOnNoRoute; + this.slowConsumerThreshold = slowConsumerThreshold; + this.slowConsumerCheckPeriod = slowConsumerCheckPeriod; + this.slowConsumerPolicy = slowConsumerPolicy; + } + + // Public -------------------------------------------------------- + + public int getPageCacheMaxSize() + { + return pageCacheMaxSize; + } + + public void setPageCacheMaxSize(int pageCacheMaxSize) + { + this.pageCacheMaxSize = pageCacheMaxSize; + } + + public String getAddressFullMessagePolicy() + { + return addressFullMessagePolicy; + } + + public long getMaxSizeBytes() + { + return maxSizeBytes; + } + + public int getPageSizeBytes() + { + return pageSizeBytes; + } + + public int getMaxDeliveryAttempts() + { + return maxDeliveryAttempts; + } + + public long getRedeliveryDelay() + { + return redeliveryDelay; + } + + public String getDeadLetterAddress() + { + return deadLetterAddress; + } + + public String getExpiryAddress() + { + return expiryAddress; + } + + public boolean isLastValueQueue() + { + return lastValueQueue; + } + + public long getRedistributionDelay() + { + return redistributionDelay; + } + + public boolean isSendToDLAOnNoRoute() + { + return sendToDLAOnNoRoute; + } + + public double getRedeliveryMultiplier() + { + return redeliveryMultiplier; + } + + public long getMaxRedeliveryDelay() + { + return maxRedeliveryDelay; + } + + public long getSlowConsumerThreshold() + { + return slowConsumerThreshold; + } + + public long getSlowConsumerCheckPeriod() + { + return slowConsumerCheckPeriod; + } + + public String getSlowConsumerPolicy() + { + return slowConsumerPolicy; + } +} + http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BridgeControl.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BridgeControl.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BridgeControl.java new file mode 100644 index 0000000..5faa8b6 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BridgeControl.java @@ -0,0 +1,83 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.management; + + +/** + * A BridgeControl is used to manage a Bridge. + * + * @author <a href="[email protected]">Jeff Mesnil</a> + * + */ +public interface BridgeControl extends HornetQComponentControl +{ + /** + * Returns the name of this bridge + */ + String getName(); + + /** + * Returns the name of the queue this bridge is consuming messages from. + */ + String getQueueName(); + + /** + * Returns the address this bridge will forward messages to. + */ + String getForwardingAddress(); + + /** + * Returns the filter string associated to this bridge. + */ + String getFilterString(); + + /** + * Return the name of the org.apache.activemq6.core.server.cluster.Transformer implementation associated to this bridge. + */ + String getTransformerClassName(); + + /** + * Returns any list of static connectors used by this bridge + */ + String[] getStaticConnectors() throws Exception; + + /** + * Returns the name of the discovery group used by this bridge. + */ + String getDiscoveryGroupName(); + + /** + * Returns the retry interval used by this bridge. + */ + long getRetryInterval(); + + /** + * Returns the retry interval multiplier used by this bridge. + */ + double getRetryIntervalMultiplier(); + + /** + * Returns the number of reconnection attempts used by this bridge. + */ + int getReconnectAttempts(); + + /** + * Returns whether this bridge is using duplicate detection. + */ + boolean isUseDuplicateDetection(); + + /** + * Returns whether this bridge is using high availability + */ + boolean isHA(); +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BroadcastGroupControl.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BroadcastGroupControl.java b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BroadcastGroupControl.java new file mode 100644 index 0000000..cc6e7a1 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/BroadcastGroupControl.java @@ -0,0 +1,58 @@ +/* + * Copyright 2005-2014 Red Hat, Inc. + * Red Hat licenses this file to you under the Apache License, version + * 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package org.apache.activemq6.api.core.management; + +/** + * A BroadcastGroupControl is used to manage a broadcast group. + * + * @author <a href="[email protected]">Jeff Mesnil</a> + * + */ +public interface BroadcastGroupControl extends HornetQComponentControl +{ + /** + * Returns the configuration name of this broadcast group. + */ + String getName(); + + /** + * Returns the local port this broadcast group is bound to. + */ + int getLocalBindPort() throws Exception; + + /** + * Returns the address this broadcast group is broadcasting to. + */ + String getGroupAddress() throws Exception; + + /** + * Returns the port this broadcast group is broadcasting to. + */ + int getGroupPort() throws Exception; + + /** + * Returns the period used by this broadcast group. + */ + long getBroadcastPeriod(); + + /** + * Returns the pairs of live-backup connectors that are broadcasted by this broadcast group. + */ + Object[] getConnectorPairs(); + + /** + * Returns the pairs of live-backup connectors that are broadcasted by this broadcast group + * using JSON serialization. + */ + String getConnectorPairsAsJSON() throws Exception; +}
