views:

378

answers:

2

I have a plugin for OpenFire that creates and delivers a message to a user using

XMPPServer.getInstance().getMessageRouter().route(message)

What I would like to know is what happens to that message if the user is not online.

My goal is to only have the message delivered if the user is online, and fail or be routed to the bit bucket otherwise.

+1  A: 

It's all down to Openfire config. In the Openfire admin console, go to Server -> Server Settings -> Offline Messages. There are options for store, bounce and drop.

  • Store: deliver the message when the user comes back online.
  • Drop: Just discard the message.
  • Bounce: Discard and notify the sender with a return message.
Chase Seibert
Looks good. Don't suppose you have any idea what bounce will do when the sender is a plugin?
Robin
Even when sending via an API, the message needs to be from someone. The server will try to reply to that address, and fail if it's not valid or not currently logged in.
Chase Seibert
A: 

Another approach, if you just want these messages to not go offline without affecting the delivery of other messages, is to use type='headline'. Headlines are not terribly well-specified, but RFC 3921bis Section 5.2.2 says:

headline -- The message provides an alert, a notification, or other information to which no reply is expected (e.g., news headlines, sports updates, near-real-time market data, and syndicated content). Because no reply to the message is expected, typically a receiving client will present a message of type "headline" in an interface that appropriately differentiates the message from standalone messages, chat messages, or groupchat messages (e.g., by not providing the recipient with the ability to reply). The receiving server SHOULD deliver the message to all of the recipient's available resources.

Most servers of today will just silently drop headlines to offline users, and deliver to the highest priority resource if the user is online.

Joe Hildebrand