001/**
002 *
003 * Copyright 2015 Florian Schmaus
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smack.iqrequest;
018
019import org.jivesoftware.smack.packet.IQ;
020
021/**
022 * IQ request handler are responsible for handling incoming IQ requests. They can be registered with
023 * {@link org.jivesoftware.smack.XMPPConnection#registerIQRequestHandler(IQRequestHandler)}.
024 *
025 * @see AbstractIqRequestHandler
026 */
027public interface IQRequestHandler {
028
029    enum Mode {
030        /**
031         * Process requests synchronously, i.e. in the order they arrive. Uses a single thread, which means that the other
032         * requests have to wait until all previous synchronous requests have been handled. Use {@link #async} if
033         * possible for performance reasons.
034         */
035        sync,
036
037        /**
038         * Process IQ requests asynchronously, i.e. concurrent. This does not guarantee that requests are processed in the
039         * same order they arrive.
040         */
041        async,
042    }
043
044    IQ handleIQRequest(IQ iqRequest);
045
046    Mode getMode();
047
048    IQ.Type getType();
049
050    String getElement();
051
052    String getNamespace();
053}