Code example for EventBus

Methods: post

0
    public EventPublisher(EventBus eventBus) {
        this.eventBus = eventBus;
    } 
 
    public void createCashPurchaseEvent(String description, long amount) {
        eventBus.post(new CashPurchaseEvent(amount, description));
    } 
 
    public void createCreditPurchaseEvent(String item, String ccNumber, long amount) {
        eventBus.post(new CreditPurchaseEvent(amount, ccNumber, item));
    } 
 
    public void createSimpleEvent(String eventName) {
        eventBus.post(new SimpleEvent(eventName));
    } 
 
    public void createNoSubscribedEvent() { 
        eventBus.post(new NoSubscriberEvent());
    }