001    /*
002     * Copyright 2009 Red Hat, Inc.
003     * Red Hat licenses this file to you under the Apache License, version
004     * 2.0 (the "License"); you may not use this file except in compliance
005     * with the License.  You may obtain a copy of the License at
006     *    http://www.apache.org/licenses/LICENSE-2.0
007     * Unless required by applicable law or agreed to in writing, software
008     * distributed under the License is distributed on an "AS IS" BASIS,
009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
010     * implied.  See the License for the specific language governing
011     * permissions and limitations under the License.
012     */
013    
014    package org.hornetq.spi.core.protocol;
015    
016    import org.hornetq.api.core.SimpleString;
017    import org.hornetq.core.server.ServerMessage;
018    import org.hornetq.spi.core.remoting.ReadyListener;
019    
020    /**
021     * A SessionCallback
022     *
023     * @author Tim Fox
024     *
025     *
026     */
027    public interface SessionCallback
028    {
029       void sendProducerCreditsMessage(int credits, SimpleString address);
030    
031       int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
032    
033       int sendLargeMessage(ServerMessage message, long consumerID, long bodySize, int deliveryCount);
034    
035       int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
036    
037       void closed();
038    
039       void addReadyListener(ReadyListener listener);
040    
041       void removeReadyListener(ReadyListener listener);
042    }