
com.fluxtion.server.config.EventSinkConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server Show documentation
Show all versions of server Show documentation
A runtime server to load and run Fluxtion event processors, connecting event streams to and from processors
/*
* SPDX-FileCopyrightText: © 2024 Gregory Higgins
* SPDX-License-Identifier: AGPL-3.0-only
*/
package com.fluxtion.server.config;
import com.fluxtion.agrona.concurrent.Agent;
import com.fluxtion.agrona.concurrent.IdleStrategy;
import com.fluxtion.runtime.annotations.feature.Experimental;
import com.fluxtion.runtime.output.MessageSink;
import com.fluxtion.runtime.service.Service;
import com.fluxtion.server.dutycycle.ServiceAgent;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import java.util.function.Function;
@Experimental
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EventSinkConfig> {
private T instance;
private String name;
private Function super T, ?> valueMapper = Function.identity();
//optional agent configuration
private String agentName;
private IdleStrategy idleStrategy;
public boolean isAgent() {
return agentName != null;
}
@SneakyThrows
@SuppressWarnings({"unchecked", "all"})
public Service toService() {
instance.setValueMapper(valueMapper);
Service svc = new Service(instance, MessageSink.class, name);
return svc;
}
@SneakyThrows
@SuppressWarnings({"unchecked", "all"})
public ServiceAgent toServiceAgent() {
Service svc = toService();
return new ServiceAgent<>(agentName, idleStrategy, svc, (A) instance);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy