コード例 #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);
  }
コード例 #2
0
 @Override
 public MessagingFraction defaultFraction() {
   return MessagingFraction.createDefaultFraction();
 }