Create the Embedded Gateway Object

This procedure describes how to create Gateway objects within your Java program.

Before You Begin

This procedure is part of Checklist: Embed Kaazing WebSocket Gateway in Your Java Application:

  1. Set Up Your Development Environment
  2. Create the Embedded Gateway Object
  3. Use the Embedded Gateway Methods
  4. Configure Logging for an Embedded Gateway
  5. Monitor and Manage an Embedded Gateway
  6. Troubleshoot Your Embedded Gateway

To Create an Embedded Gateway Object

  1. Import the embedded Gateway class into your Java application:
    import com.kaazing.gateway.server.GatewayFactory;
    import com.kaazing.gateway.server.Gateway;
    
  2. Create the embedded Gateway using the following publicly available static method:
    GatewayFactory.createGateway();

Example

The following example demonstrates how you can embed the Gateway:

import com.kaazing.gateway.server.GatewayFactory;
import com.kaazing.gateway.server.Gateway;

public class GatewayTest {
  private Gateway gw;

  public GatewayTest() {
    gw = GatewayFactory.createGateway();
  }
}

Next Steps

Use the Embedded Gateway Methods

TOP