1 /* 2 * $Id: XmppConversation.java 19191 2010-08-25 21:05:23Z tcarlson $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.transport.xmpp; 12 13 import org.mule.transport.ConnectException; 14 15 import org.jivesoftware.smack.XMPPException; 16 import org.jivesoftware.smack.packet.Message; 17 18 /** 19 * Implementors of <code>XmppConversation</code> abstract from the XMPP conversation type 20 * (e.g. chat, multi user chat or sending of plain jabber messages). 21 */ 22 public interface XmppConversation 23 { 24 /** 25 * Connect to the Jabber conversation, e.g. join a chat. 26 */ 27 void connect() throws ConnectException; 28 29 /** 30 * Disconnect from the Jabber conversation, e.g. leave a chat. 31 */ 32 void disconnect(); 33 34 /** 35 * Asynchronously dispatch <code>message</code> via the Jabber conversation. 36 */ 37 void dispatch(Message message) throws XMPPException; 38 39 /** 40 * Wait for a response on this conversation until <code>timeout</code> occurs. 41 * 42 * @return {@link Message} next available message or <code>null</code> if timeout occurred. 43 */ 44 Message receive(long timeout); 45 46 /** 47 * Wait for a response on this conversation until a message arrives. 48 */ 49 Message receive(); 50 }