} catch (XMPPException e) {
throw new RuntimeExchangeException("Cannot connect to: "
+ XmppEndpoint.getConnectionMessage(connection), exchange, e);
}
ChatManager chatManager = connection.getChatManager();
if (LOG.isTraceEnabled()) {
LOG.trace("Looking for existing chat instance with thread ID " + endpoint.getChatId());
}
Chat chat = chatManager.getThreadChat(endpoint.getChatId());
if (chat == null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Creating new chat instance with thread ID " + endpoint.getChatId());
}
chat = chatManager.createChat(getParticipant(), endpoint.getChatId(), new MessageListener() {
public void processMessage(Chat chat, Message message) {
// not here to do conversation
if (LOG.isDebugEnabled()) {
LOG.debug("Received and discarding message from " + getParticipant() + " : " + message.getBody());
}