Exemplo n.º 1
0
  public static void main(String[] args) throws Exception {
    Swarm swarm = new Swarm();

    swarm.fraction(
        MessagingFraction.createDefaultFraction()
            .defaultServer(
                (s) -> {
                  s.enableClustering();
                  s.jmsTopic("my-topic");
                  s.jmsQueue("my-queue");
                }));

    // Start the container
    swarm.start();

    JAXRSArchive appDeployment = ShrinkWrap.create(JAXRSArchive.class);
    appDeployment.addResource(MyResource.class);

    // Deploy your app
    swarm.deploy(appDeployment);

    JARArchive deployment = ShrinkWrap.create(JARArchive.class);
    deployment.addClass(MyService.class);
    deployment.as(ServiceActivatorArchive.class).addServiceActivator(MyServiceActivator.class);

    // Deploy the services
    swarm.deploy(deployment);
  }
Exemplo n.º 2
0
 public static void main(String... args) throws Exception {
   Swarm container = new Swarm();
   container.fraction(new ManagementConsoleFraction());
   container.start();
 }