Java Code Examples for org.wildfly.swarm.topology.Topology#lookup()

The following examples show how to use org.wildfly.swarm.topology.Topology#lookup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: App.java    From drools-workshop with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Container container = new Container();

    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
    deployment.as(TopologyArchive.class).advertise("restaurantService");
    deployment.setContextRoot("/api");
    deployment.addPackages(true, "org.jboss.shrinkwrap.api");
    deployment.addAsLibrary(container.createDefaultDeployment());
    deployment.addAllDependencies();
    container.start();
    container.deploy(deployment);

    Topology lookup = Topology.lookup();
    lookup.addListener(new TopologyListener() {
        @Override
        public void onChange(Topology tplg) {
            System.out.println(">>> Delivery Service: The Topology Has Changed!");
            printTopology(lookup);
        }
    });
    
    printTopology(lookup);

}
 
Example 2
Source File: App.java    From drools-workshop with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Container container = new Container();

    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
    deployment.as(TopologyArchive.class).advertise("deliveryService");
    deployment.setContextRoot("/api");
    deployment.addPackages(true, "org.jboss.shrinkwrap.api");
    deployment.addAsLibrary(container.createDefaultDeployment());
    deployment.addAllDependencies();
    container.start();
    container.deploy(deployment);
    
    Topology lookup = Topology.lookup();
    lookup.addListener(new TopologyListener() {
        @Override
        public void onChange(Topology tplg) {
            System.out.println(">>> Delivery Service: The Topology Has Changed!");
            printTopology(lookup);
        }
    });
    
    printTopology(lookup);
    
}
 
Example 3
Source File: App.java    From drools-workshop with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Container container = new Container();

    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
    deployment.as(TopologyArchive.class).advertise("foodService");
    deployment.setContextRoot("/api");
    deployment.addPackages(true, "org.jboss.shrinkwrap.api");
    deployment.addAsLibrary(container.createDefaultDeployment());
    deployment.addAllDependencies();
    container.start();
    container.deploy(deployment);
    
    Topology lookup = Topology.lookup();
    lookup.addListener(new TopologyListener() {
        @Override
        public void onChange(Topology tplg) {
            System.out.println(">>> Delivery Service: The Topology Has Changed!");
            printTopology(lookup);
        }
    });
    
    printTopology(lookup);
    
}
 
Example 4
Source File: TopologySSEServlet.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public void init(ServletConfig config) throws ServletException {

    super.init(config);

    try {
        this.topology = Topology.lookup();
    } catch (NamingException e) {
        throw new ServletException(e);
    }

    this.keepAliveExecutor = Executors.newScheduledThreadPool(2);
}
 
Example 5
Source File: TopologyProxyService.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public void start(StartContext context) throws StartException {
    try {
        Topology topology = Topology.lookup();
        topology.addListener(this);
    } catch (NamingException ex) {
        throw new StartException(ex);
    }
}
 
Example 6
Source File: ArqTopologyOpenShiftTest.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Test
public void testIt() throws Exception {
    Topology topology = Topology.lookup();
    assertThat(topology).isNotNull();
}
 
Example 7
Source File: ArqTopologyJGroupsTest.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Test
public void testIt() throws Exception {
    Topology topology = Topology.lookup();
    assertThat(topology).isNotNull();
}
 
Example 8
Source File: ArqTopologyConsulTest.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Test
public void testIt() throws Exception {
    Topology topology = Topology.lookup();
    assertThat(topology).isNotNull();
}