« - »

Notification Service: Message delivery service

14 November 2008

Now that we have the one MessageCourier defined, we need to create a simple service that will invoke the proper MessageCourier to deliver the message based on the delivery method. The interface to support that requirement is actually pretty straightforward, and almost a clone of the MessageCourier interface itself, with the addition of the delivery method parameter:

package org.restafarian.notify.service;

import java.util.List;

import org.restafarian.notify.beans.MessageAddress;

/**
 * <p>This is the DeliveryService interface.</p>
 */
public interface DeliveryService {

  /**
   * <p>Delivers the message to the specified recipient(s) using the
   * specified delivery method.</p>
   *
   * @param deliveryMethod the method to be used to deliver the message
   * @param addresses an array of "address" objects containing the
   * implementation-specific addresses required for successful delivery of
   * the message
   * @param titleSubject an optional subject and/or title of the message to
   * be delivered
   * @param contentType the mime type of the message body
   * @param body the text of the message to be delivered
   */
  public void deliverMessage(String deliveryMethod, MessageAddress[] addresses,
       String titleSubject, String contentType, String body);
}

Of course, implementing that interface is another story. How best to translate the passed delivery method requirement into an actual MessageCourier is something that we will have to work out, and hopefully work out in a way that will allow one to add new methods of delivery without having to rebuild the entire service and reploy the software. That may take a little thought …


http://blog.restafarian.org/2008/11/notification-service-message-delivery-service/

Leave a reply

You must be logged in to post a comment.