Overview
Previous Topic  Next Topic 


Messages

ITAnyplace Enterprise Edition provides robust Notification capability. It can push 3 types of messages to the devices:

This option is used when a message needs to be sent to the user only once and the user is generally a temporary user and might not be registered in the system. For example, in a restaurant queue management scenario, a message can be sent to the user when a table becomes available. For such messages,the enterprise app should set the appropriate type and mention the adapter name to be used for delivery. Adapter name should match one of the adapter names in notificationadapters.xml. App should also put a phone number or email in the recipient field depending upon the delivery method chosen. When ITAnyplace receives a message of this type, it reads the address from the recipient field, gets the appropriate adapter and dispatches the notification to that address.


       Bulk notifications can be sent to users by using this type. For such messages, app should set the appropriate type and mention the adapter name to be used for delivery. Adapter name should match one of the adapter names in notificationadapters.xml. App should also put email or phone numbers delimited by com.itanyplace.notification.Message.ITEM_DELIMITER. When ITAnyplace receives a message of this type, it reads the addresses from the recipient field, gets the appropriate adapter from notification context and dispatches the notification to those addresses.


These messages are sent to the users who are registered in the system. The user specifies the topics in which he or she is interested and chooses one or more delivery methods. When ITAnyplace receives a message of this type, it searches for users who are subscribed to that topic and looks for their delivery preferences. It then uses the appropriate adapter from the NotificationAdapterList and dispatches the notification to the user.



Adapters

The delivery of messages in ITAnyplace platform is handled by the adapters. The platform ships with 3 adapters:

This adapter is used to send email messages to users. It uses SMTP protocol to send the messages. Please set up your SMTP server, valid email address and password in notificationadapters.xml for sending emails. The email address specified in the notificationadapters.xml is used as the sender. It can also retrieve incoming email messages by using POP3 protocol. The incoming messages are read for the email address specified under email adapter in notificationadapters.xml. The default incoming message handler just dumps the incoming message in the log file. The developers can specify a different handler by changing the 'incomingmessagehandlerclass' parameter in notificationadapters.xml. The handler specified here should implement com.itanyplace.notification.adapters.IncomingMessageHandler interface.


This adapter is used to send SMS messages to users. Please enter GSM modem information in notificationadapters.xml. The adapter uses SMPP protocol and AT commands to send the messages. It can also retrieve incoming SMS messages. The default incoming message handler just dumps the incoming message in the log file. The developers can specify a different handler by changing the 'incomingmessagehandlerclass' parameter in notificationadapters.xml. The handler specified here should implement com.itanyplace.notification.adapters.IncomingMessageHandler interface.


This adapter consists of a client and a server component. When the server component receives a message, it stores it in the local database. When the user's device is online, server contacts the device and sends the messages to it. The messages received by the device are stored in the message center. Each client app can then poll the device message center and obtain and process the messages relevant to it.


This adapter can process 2 types of messages:

These messages are received by the client app and displayed as plain text without further processing. For example, in an expense form scenario, if an employee submits an expense form, a simple message can be sent to the manager that the form has been submitted. The message is displayed as such to the user by the client app.

This type of message is used if say in the expense form scenario, instead of simple text, the complete expense form needs to be sent to the device. The client app then processes it as a com.itanyplace.sync.SyncMessage object and performs an Add/Update/Delete operation.


Developers can write their own adapters. Configuration information for custom adapters should be added to notificationadapters.xml. All adapters should implement the com.itanyplace.notification.adapters.NotificationAdapter interface.



Event submission

The platform provides a servlet http://<your server name>:<your server port>/itanyplace/notification/publishevent. This servlet can be used by the enterprise apps to submit events/messages to the platform. The servlet expects the following parameters, some of which are optional: redirectURL, sourceURI, sender, receiver, notificationtype (registered user: 0, one time: 1, bulk: 2), adaptername, messagetype (simple: 0, sync: 1), topic, body. Please look at testnotification.jsp in itanyplacenotificationmanager webapp for an example of how to submit events.