Search in sources :

Example 1 with RSocketFilter

use of com.alibaba.rsocket.route.RSocketFilter in project alibaba-rsocket-broker by alibaba.

the class RSocketBrokerManagerGossipImpl method onCloudEvent.

public void onCloudEvent(CloudEventImpl<?> cloudEvent) {
    String type = cloudEvent.getAttributes().getType();
    Optional<?> cloudEventData = cloudEvent.getData();
    cloudEventData.ifPresent(data -> {
        if (RSocketFilterEnableEvent.class.getCanonicalName().equals(type)) {
            try {
                RSocketFilterEnableEvent filterEnableEvent = (RSocketFilterEnableEvent) data;
                RSocketFilter rsocketFilter = (RSocketFilter) applicationContext.getBean(Class.forName(filterEnableEvent.getFilterClassName()));
                rsocketFilter.setEnabled(filterEnableEvent.isEnabled());
            } catch (Exception ignore) {
            }
        }
    });
}
Also used : RSocketFilterEnableEvent(com.alibaba.spring.boot.rsocket.broker.events.RSocketFilterEnableEvent) RSocketFilter(com.alibaba.rsocket.route.RSocketFilter)

Aggregations

RSocketFilter (com.alibaba.rsocket.route.RSocketFilter)1 RSocketFilterEnableEvent (com.alibaba.spring.boot.rsocket.broker.events.RSocketFilterEnableEvent)1