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