001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.messaging;
016    
017    import java.util.Collection;
018    
019    /**
020     * @author Michael C. Han
021     */
022    public interface MessageBus {
023    
024            public void addDestination(Destination destination);
025    
026            public boolean addMessageBusEventListener(
027                    MessageBusEventListener messageBusEventListener);
028    
029            public Destination getDestination(String destinationName);
030    
031            public int getDestinationCount();
032    
033            public Collection<String> getDestinationNames();
034    
035            public Collection<Destination> getDestinations();
036    
037            public boolean hasDestination(String destinationName);
038    
039            public boolean hasMessageListener(String destinationName);
040    
041            public boolean registerMessageListener(
042                    String destinationName, MessageListener messageListener);
043    
044            public Destination removeDestination(String destinationName);
045    
046            public Destination removeDestination(
047                    String destinationName, boolean closeOnRemove);
048    
049            public boolean removeMessageBusEventListener(
050                    MessageBusEventListener messageBusEventListener);
051    
052            public void replace(Destination destination);
053    
054            public void replace(Destination destination, boolean closeOnReplace);
055    
056            public void sendMessage(String destinationName, Message message);
057    
058            public void shutdown();
059    
060            public void shutdown(boolean force);
061    
062            public boolean unregisterMessageListener(
063                    String destinationName, MessageListener messageListener);
064    
065    }