custom adapter called more than the frequency set

1569
1
09-15-2014 08:55 PM
BillHan
New Contributor

I installed the sample adapter and set debug point of adapt method, I configured an input that uses this adapter. I set the frequency to be 360 seconds, but the adapter is called like every second. Is this normal behavior?

0 Kudos
1 Reply
JacobHays
New Contributor II

A bit late with a response but might still be of help. 

You might check the logs to see if there is an indication of the input transport running more frequently than the 360 seconds that you specified.  That is assuming you don't have direct access to the transport code to debug.

If that checks out fine then I've got another idea.  The inbound adapter sample as packaged uses the bulk ByteBuffer.get method but with a limitation of 10 bytes on the byte array that it is going to copy bytes to.  If your incoming ByteBuffer data is larger than that 10 bytes, the bulk get method will only move the read position in the buffer that 10 bytes.  Adapt will continue to get called until the entire buffer is consumed, up to the buffer limit.

So you could do either of the following:

  • Make the byte array larger to a hard coded size (100, 1024, etc)
    • byte[] data = new byte[1024];

    • buffer.get(data);

  • Create the byte array to be as large as the incoming buffer data size
    • byte[] data= new byte[buffer.remaining()];

    • buffer.get(data);

There is a maximum size limitation on the incoming buffer, I think it is 20 MB or around there.  Might be larger in later versions (greater than 10.2.2).

0 Kudos