简体   繁体   中英

IEventBroker doesn't sent event in java

I want to send success message by IEventBroker and listen it from another class. I could not handle the message from listener function. What can be its cause?

I sent the message by this line :

eventBroker.post(IBackupRestoreEventConstants.TOPIC_BACKUP_SUCCESS, new Date());

I want to handle in this function:

@Inject
@Optional
public void whenBackupSuccess(@UIEventTopic(IBackupRestoreEventConstants.TOPIC_BACKUP_SUCCESS) long timeStamp) {
    MessageDialog.openInformation(shell, "Information", "Backup operation completed successfully");
}

You are posting an event with a Date value but you are using long as the argument in whenBackupSuccess , the event broker will not do this conversion for you. Since the method is @Optional it will just be ignored.

Use Date in whenBackupSuccess :

@Inject
@Optional
public void whenBackupSuccess(@UIEventTopic(IBackupRestoreEventConstants.TOPIC_BACKUP_SUCCESS) Date timeStamp)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM