The file that is linked below includes an example of a workflow configuration that uses the Java agent:The sample workflow is a simple real time workflow that contains a pulse agent that periodically sends pulses of data into the Java agent, where the Java codes will debug the input and route it back out to the Analysis agent.
...
Code Blocklanguage java title HelloworldAgent.java
package com.mediationzone.java_agent;
import com.digitalroute.mz.java.agents.RealtimeAgent;
import com.digitalroute.mz.java.agents.api.AgentEnv;
import com.digitalroute.mz.java.agents.api.ConfigDefinition;
import com.digitalroute.mz.java.agents.UDRInterface;
import java.util.Map;
public class HelloworldAgent implements RealtimeAgent {
@Override
public void configure(ConfigDefinition cfg) {
cfg.defineOutput(byte[].class, UDRInterface.class);
//cfg.defineOutput(Your_UDR.class);
//cfg.defineOutput("routename", Your_UDR.class);
}
@Override
public void deinitialize(AgentEnv env) throws Exception {
}
@Override
public void init(AgentEnv env, Map<String,String> userdata) throws Exception {
}
@Override
public void consume(UDRInterface input, AgentEnv env) throws Exception {
// try {
// env.debug(input);
//
// Your_UDR newUdr = env.createUDR(Your_UDR.class);
//
// Your_UDR udr = (Your_UDR) input;
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
//
env.debug("Hello World");
env.route(input);
}
@Override
public void consume(byte[] input, AgentEnv env) throws Exception {
env.debug("Hello World");
env.route(input);
}
@Override
public Object getMIM(String mimName) {
return null;
}
}
Scroll ignorescroll-viewport false scroll-pdf true scroll-office false scroll-chm true scroll-docbook true scroll-eclipsehelp true scroll-epub true scroll-html false
Next: