(Optional) Enable guaranteed delivery (GD) in a custom input transporter by
implementing the com.sybase.esp.adapter.framework.event.AdapterRowEventListener
interface, registering the GdAdapterEventListener class, and adding and setting the
<GDMode> parameter to true for the EspPublisher
or EspMultistreamPublisher.
Prerequisites
Create a custom input transporter module.
Task- In the adapter configuration file, add the <GDMode>
parameter and set it to true for the EspPublisher or
EspMultiStreamPublisher:
- For EspPublisher:
<EspPublisherParameters>
<ProjectName>EspProject1</ProjectName>
<StreamName>MyInStream</StreamName>
<GDMode>true</GDMode>
</EspPublisherParameters>
- For EspMultiStreamPublisher:
<EspMultiStreamPublisherParameters>
<Streams>
<Stream>
<ProjectName>EspProject1</ProjectName>
<StreamName>MyInStream1</StreamName>
<GDMode>true</GDMode>
</Stream>
</Streams>
</EspMultiStreamPublisherParameters>
- Implement the com.sybase.esp.adapter.framework.event.AdapterRowEventListener
interface. For example,
public class GdAdapterEventListener implements AdapterRowEventListener
{
public void adapterEventPerformed(AdapterRowEvent event) {
List<AdapterRow> rows = event.getAdapterRows();
switch(event.getType())
{
case PUBLISH SUCCESS:
processPublishSuccess();
break;
case PUBLISH FAILURE:
processPublishFailure();
break;
case FORMAT FAILURE:
processFormatFailure();
break;
default:
break;
}
}
}
- Create the class GdAdapterEventListener and register it to enable GD in the input
transporter when it starts up. For example,
GdAdapterEventListener gdProcessor = new GdAdapterEventListener();
utility.getAdapterUtility().registerRowEventListener(gdProcessor,
EventType.PUBLISH_SUCCESS);
utility.getAdapterUtility().registerRowEventListener(gdProcessor,
EventType.PUBLISH_FAILURE);
utility.getAdapterUtility().registerRowEventListener(gdProcessor,
EventType.FORMAT_FAILURE);
- Ensure that you keep track of the last row successfully
published to ESP, either by
using your external datasource or the transporter
itself.
If using the input transporter, you can get the last row
successfully published from the PUBLISH_SUCCESS message. If
you are publishing in transactions or envelopes, the
PUBLISH_SUCCESS message contains all rows in the last
transaction or envelope to be successfully published. If you
publish in single rows, the message contains the last single
row that was successfully published.