Internal and External Adapters

An adapter that runs as part of the Event Stream Processor Server is called an internal adapter. An adapter that runs as a separate process is called an external adapter.

Internal adapters generally run faster because the Server can get data from (or to) the adapter with less overhead. Internal adapters are started by the Server when it starts the corresponding project (query module). The adapter is recognized by Sybase Event Stream Processor Studio, and from inside Studio, you can attach the adapter to a stream by selecting the adapter from a menu of adapters. A disadvantage of internal adapters is that if the adapter fails, it may also cause the Server to fail.

External adapters have more flexibility than internal adapters and can run on a different machine than the Server. They can be either "managed" or "unmanaged." Managed external adapters provide an adapter configuration file (.cnxml) that can be configured using Studio, referenced in a CCL ATTACH ADAPTER statement, and can be started and stopped by the Server, behaving very similarly to an internal adapter. Unmanaged external adapters are not referenced in a CCL ATTACH ADAPTER statement, and are not managed by the Server. You start, stop, and configure these adapters independently.

Internal and External Adapters
  Internal External Managed External Unmanaged Considerations
API Written using internal adapter API (C++ only). Written using the Pub/Sub API (SDK supported languages: C++, Java, and .Net). Written using the Pub/Sub API (SDK supported languages: C++, Java, and .Net). Depends on choice of language.
Direction Can be either input or output. Can be input, output, or both. Can be input, output, or both. If you need an adapter to both publish and subscribe, use an external adapter.
Process space Inside the Event Stream Processor engine process. Within a separate process. Within a separate process.

Running inside the Event Stream Processor engine process has performance advantages because it allows the adapter to share memory with the query processor and avoids unnecessary copying.

Running in a separate process can potentially give you more flexibility for starting and stopping adapter. For example, if the ESP Server shuts down unexpectedly, so does the internal adapter. An external adapter, however, is unaffected in this situation.

What the adapter runs on Required to run on an Event Stream Processor node. This is the same node that runs the CCL project. May run on any machine, as long as it can be started and stopped by the ESP Server using a shell script. May run on any machine. Sometimes you must run an adapter on the same machine as some service or application, for example, a feed that is tied by license to a particular host. If it is undesirable or impossible for that machine to run Event Stream Processor, you must use an external adapter.
Reading and writing data Data is fed directly into the Event Stream Processor engine's memory space. There is no data copying or network overhead. Data must be copied and sent through the network before it makes it from the adapter to the ESP Server. Data must be copied and sent through the network before it makes it from the adapter to the ESP Server. Internal adapters are much more efficient than external adapters because data is exchanged with the engine directly through memory without copying.
Lifetime

The adapter starts when the project is started, and terminates if the project is terminated. You can stop and start the adapter separately from the project while the project is running.

The adapter stops if the ESP Server process terminates unexpectedly.

The adapter starts when the project is started and terminates if the project is terminated. You can stop and start the adapter separately from the project while the project is running.

The adapter can continue running if the ESP Server process terminates unexpectedly.

The adapter's lifetime is completely separate from project's. External unmanaged adapters give more flexibility, but require you to do all the work for starting and stopping it. If you have an existing application that must have code added to it to interact with Event Stream Processor, and it requires a separate lifetime from Event Stream Processor, this application is an external unmanaged adapter.
Attachment You must attach the adapter in the project's CCL file. You can attach it to a single stream only. You must attach the adapter in the project's CCL file. You can attach it to a single stream only. You do not need to attach it in CCL. To add or remove an adapter without having to modify CCL, consider using an external unmanaged adapter.
Related concepts
Custom Adapters
Related reference
Adapter Parameters Datatypes