18 package network.httppush;
20 import java.util.Scanner;
23 import ca.uqac.lif.cep.Connector;
24 import ca.uqac.lif.cep.ProcessorException;
25 import ca.uqac.lif.cep.functions.ApplyFunction;
26 import ca.uqac.lif.cep.http.HttpUpstreamGateway;
27 import ca.uqac.lif.cep.serialization.JsonSerializeString;
28 import ca.uqac.lif.cep.tmf.QueueSource;
46 public static void main(String[] args)
throws ProcessorException, InterruptedException
49 System.out.println(
"Hello, I am Machine A (upstream).");
50 System.out.print(
"Enter the URL to push on Machine B: ");
51 Scanner sc =
new Scanner(System.in);
52 String url = sc.nextLine();
55 QueueSource source =
new QueueSource();
60 ApplyFunction serialize =
new ApplyFunction(
new JsonSerializeString());
61 HttpUpstreamGateway up_gateway =
new HttpUpstreamGateway(url);
62 Connector.connect(source, serialize);
63 Connector.connect(serialize, up_gateway);
71 for (
int i = 0; i < 5; i++)
73 System.out.println(
"Press Enter to send a new object to Machine B. Type q to quit.");
74 String line = sc.nextLine();
75 if (line.startsWith(
"q") || line.startsWith(
"Q"))
Send events from one processor to another over a network.
This is the same example as PushLocalSerialize, but with the "Machine A" and "Machine B" parts of the...
A dummy object used to show serialization.