Multiple publish

We receive large xml file from out clients. I have written service that reads one node and converts it to a document. The document is appended to a document list. When the list of nodes read is 20 , I publish one document. This goes on till all the nodes are read.

My problem is if one of the publish fails what kind of error catching faciltiy should I code.

I was suggested that I use the join condition in the trigger, but then I am publishing mutli copies of only one document type and there can be many documents like that.

Can anyone suggest anything

First, see the recent thread on using Vector instead of using multiple appendToDocumentList calls.

See if you can extract a node and add it to an object array and then convert that to a document list in a single nodeToDocument call.

When if your publish fails, either Broker or your network is down (or you’re attempting to publish data that doesn’t match the document’s structure).

You might use a repeat block to repeat on failure 2-3 times if the error is one that is deemed to be transient. If the repeat fails, then you could attempt to persist the doc list to disk for subsequent processing.

However, at some point, if your network or Broker is down, you might just want to fail the entire document.

HTH,

Mark

I went through the threads on vectors, and I am trying to implement it .
I have a couple od questions:

  1. When I am trying to append a document to a LinkedList , it throws a null pointer exception. Can you tell me what is the data type that would be the input. I am using a document and object(LinkedList) as input and the output is the Linked List. Is that correct?

  2. If I were to keep the appendtoDocumentList, which works well as it is in my code, How do I fail the entire document…as you suggested?..Once I publish, I dont we loose control over those set of records?

Thanks,
Qwerty

You would not easily be able to fail the entire document. That is a feature of publishing after every 20 nodes are read.

Post the code from your java service so that members can offer suggestions. I’d rather not guess.

Mark

String errorMessage;
//Instantiating a Cursor
IDataCursor pipelineCursor = pipeline.getCursor();
IData document = IDataUtil.getIData( pipelineCursor, "document" );
LinkedList nList = (LinkedList) IDataUtil.get( pipelineCursor, "nList" );
pipelineCursor.destroy();
try{

    if (document!=null){
    nList.add(document);
          }
}
catch (Exception e) {
    System.out.println("Doc Missing");
                  }

IDataCursor pipelineCursor1 = pipeline.getCursor();
IDataUtil.put(pipelineCursor1,"nList", nList);
pipelineCursor1.destroy();

The inputs to the service is a document and an Object. When the service is executed it always returns a null array.
I guess am missing something.

Thanks,