public class CompositeNotificationReceiver extends Object implements INotificationReceiver
Provides the functionality to combine notification receivers.
This code shows how to create CompositeNotificationReceiver and send a message:
// Create a receiver which prints notifications in UI
INotificationReceiver receiver1 = new UINotificationReceiver1();
// Create a receiver which writes notifications in the log file
INotificationReceiver receiver2 = new LoggerNotificationReceiver2();
// Create a notification message
NotificationMessage message = NotificationMessage.createInformationMessage("test");
// Create a composite receiver
INotificationReceiver compositeReceiver = new CompositeNotificationReceiver(receiver1, receiver2);
// Send a message to the receiver
compositeReceiver.processMessage(message); // message sends to receiver1 AND receiver2
Constructor and Description |
---|
CompositeNotificationReceiver(INotificationReceiver... receivers)
Initializes a new instance of the
CompositeNotificationReceiver class. |
public CompositeNotificationReceiver(INotificationReceiver... receivers)
Initializes a new instance of the CompositeNotificationReceiver
class.
receivers
- A collection of notification receivers to combine.public void processMessage(NotificationMessage message)
Processes the message
.
processMessage
in interface INotificationReceiver
message
- The message to process.Copyright © 2019. All rights reserved.