Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014 dc-square GmbH
   *
   * Licensed 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 com.dcsquare.hivemq.spi.services;
 
 
 import java.util.List;

The Bridge Manager Service which can be used to add, start, stop, remove and list bridge information at runtime

While typically HiveMQ bridges are configured in a bridge.xml file, it is entirely possible to write an own bridge configuration mechanism with that manager in your plugin.

Author(s):
Dominik Obermaier
Since:
2.0
 
 public interface BridgeManagerService {

    
Adds a new com.dcsquare.hivemq.spi.bridge.Bridge to the bridge manager. The bridge won't be started but can be listed.

Parameters:
bridge the bridge to add to the bridge manager.
 
     public void addBridge(final Bridge bridge);

    
Removes a bridge from the bridge manager. If the bridge to remove is running, it will be stopped and terminated before it is removed. Please note, that this method will block until the bridge is terminated. If you want to stop the bridge asynchronously, consider using the stopBridge method before removing the bridge.

If the passed bridge to remove doesn't exist, nothing will happen.

Parameters:
bridge the bridge to stop (if running) and remove
 
     public void removeBridge(final Bridge bridge);

    
Starts a bridge. If the bridge wasn't added to the manager before, it will be added automatically.

This method starts the bridge asynchronously. You can use the returned com.google.common.util.concurrent.ListenableFuture to decide if you want to block until the bridge is started or if you want to use a reactive programming pattern.

Note, that you can start a LAZY bridge manually with this method without waiting for passing the configured threshold. Also, you can reconnect disconnected bridges with bridge mode ONCE.

Parameters:
bridge the bridge to start
Returns:
a com.google.common.util.concurrent.ListenableFuture which you can use to block or use to react when the bridge started
 
     public ListenableFuture<VoidstartBridge(final Bridge bridge);

    
Stops a bridge. This method does not remove a bridge from the bridge manager. If you would like to get the bridge also removed from the bridge manager, consider using the removeBridge method.

This method stops the bridge asynchronously. You can use the returned com.google.common.util.concurrent.ListenableFuture to decide if you want to block until the bridge is stopped or if you want to use a reactive programming pattern.

Parameters:
bridge the bridge to stop
Returns:
a com.google.common.util.concurrent.ListenableFuture which you can use to block or use to react when the bridge stopped
 
     public ListenableFuture<VoidstopBridge(final Bridge bridge);

    
Returns a java.util.Collection of all bridges registered to this bridge manager.

Returns:
a java.util.Collection of all bridges registered to this bridge manager
 
     public Collection<BridgelistBridges();

    
Stops all bridges. This method does not remove bridges from the bridge manager.

This method stops the bridges asynchronously. You can use the returned com.google.common.util.concurrent.ListenableFuture to decide if you want to block until all bridges are stopped or if you want to use a reactive programming pattern.

Returns:
a com.google.common.util.concurrent.ListenableFuture which you can use to block or use to react when all bridges are stopped
    public ListenableFuture<List<Void>> stopAllBridges();

    
Returns the state of a given bridge. If the passed bridge does not exist, an Optional with an absent value will be returned

Parameters:
bridge the bridge to check the state for.
Returns:
a com.google.common.base.Optional with the state for a bridge.
    public Optional<StategetBridgeState(final Bridge bridge);
New to GrepCode? Check out our FAQ X