mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/notifications/DefaultNotificationCenter.java
@Override
	public void publish(Object channel, String messageName, Object[] payload) {
		if (channelObserverMap.containsKey(channel)) {
			final ObserverMap observerMap = channelObserverMap.get(channel);
			
			if (shouldPublishInThisThread()) {
				publish(messageName, payload, observerMap);
			} else {
				try {
					Platform.runLater(() -> publish(messageName, payload, observerMap));
				} catch (IllegalStateException e) {

					// If the toolkit isn't initialized yet we will publish the notification directly.
					// In most cases this means that we are in a unit test and not JavaFX application is running.
					if (e.getMessage().equals("Toolkit not initialized")) {
						publish(messageName, payload, observerMap);
					} else {
						throw e;
					}
				}
			}
		}
	}
@Override
	public void publish(Object channel, String messageName, Object[] payload) {
		if (channelObserverMap.containsKey(channel)) {
			final ObserverMap observerMap = channelObserverMap.get(channel);
			
			if (shouldPublishInThisThread()) {
				publish(messageName, payload, observerMap);
			} else {
				try {
					Platform.runLater(() -> publish(messageName, payload, observerMap));
				} catch (IllegalStateException e) {

					// If the toolkit isn't initialized yet we will publish the notification directly.
					// In most cases this means that we are in a unit test and not JavaFX application is running.
					if (e.getMessage().equals("Toolkit not initialized")) {
						publish(messageName, payload, observerMap);
					} else {
						throw e;
					}
				}
			}
		}
	}
@ Override public void publish ( Object channel , String messageName , Object [ ] payload ) { if ( channelObserverMap . containsKey ( channel ) ) { final ObserverMap observerMap = channelObserverMap . get ( channel ) ; if ( shouldPublishInThisThread ( ) ) { publish ( messageName , payload , observerMap ) ; } else { try { Platform . runLater ( ( ) -> publish ( messageName , payload , observerMap ) ) ; } catch ( IllegalStateException e ) { // If the toolkit isn't initialized yet we will publish the notification directly. // In most cases this means that we are in a unit test and not JavaFX application is running. if ( e . getMessage ( ) . equals ( "Toolkit not initialized" ) ) { publish ( messageName , payload , observerMap ) ; } else { throw e ; } } } } }
This notification will be send to the UI-Thread (if the UI-toolkit was bootstrapped).
If no UI-Toolkit is available the notification will be directly published. This is typically the case in unit tests.

@param channel    the channel
@param messageName    the message to sent
@param payload        additional arguments to the message
This notification will be send to the UI - Thread ( if the UI - toolkit was bootstrapped ) . If no UI - Toolkit is available the notification will be directly published . This is typically the case in unit tests .