cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle duplicate messages in J2SE File scenario

chitti_prakash
Employee
Employee
0 Kudos

Hi,

Is there any way to handle processing of duplicate messages in J2SE File adapter scenario?

Here is the scenario ,

Steps :

1. Engine picks up a message and checks the size of it.

2. Before reaching the checking interval , the adapter(file) was terminated unfortunately.

3. J2SE engine was restarted.

4. Previous file was again picked up and sent as the first time with one msgID.

5. After sometime, same file was picked up with a new msgID

6. System gets only ONE configrmation that file has been successfully transfered.

So we find two messages containing the same file.

I have checked in J2SE doc, there is a parameter called "db.exactlyOnceErrorInPendingState" which is related to DB.

Is there any similar parameter to handle the duplicate messages in FIle Adapter scenarios of J2SE Engine.

Please help me in this regard as it seems to be a new thing in J2SE AE.

Regards,

Soorya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

I believe you have the file on sender side and your Sender Communication channel read it again n again accordingly polling interval. Correct me if my understanding is wrong.

In this case I doubt about avoiding the further duplicate reading...May be you can archieve or delete the file from root path.

Thanks

swarup

chitti_prakash
Employee
Employee
0 Kudos

Hi Swarup,

Thanks for prompt response,

Before checking the file whether it is modified (with in the interval )if the adapter terminates unexpectedly then,

how can this features comes into picture. Once the message is successfully processed then the operation (delete/archive)

will come into effect. But here in first time it hadn went to that step, hence it is picking the file as a new one and processing successfully. Also processing the pending file again. This shouldn happen.

Please help me in this regard.

Regards,

Soorya.

Former Member
0 Kudos

Hi,

Yes, unfortunately thats true, if the file Sender terminates intermidietely while deleting/archiving then the file will again get read without any control.

Probably you may use some kind of control via OS commands or may be adapter mdoule.

With OS commands you may rename the file after processing...

Thanks

Swarup

chitti_prakash
Employee
Employee
0 Kudos

Hi swarup,

But using OS command how can we rename /archive that file?

Module means any Custom Module or wat?

Following are the channel configurations used in File To File scenario.

File Sender :

version=30

mode=XMB2FILE

XI.httpPort=58201

XI.httpService=/test

XI.ReceiverAdapterForService=test_rcv

file.numberOfMessageTypes=1

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

file.type=BIN

file.targetDir=/test_inb

file.targetFilename=unusedbutreq

file.writeMode=fromHeader.ext

file.createDir=0

file.nestleName=initial

file.writeMode=fromHeader.ext

file.nestleEXT=test

file.nestleFileOverwrite=False

File Receiver :

version=30

mode=FILE2XMB

XI.TargetURL=http://localhost:58201/test

XI.NestleTargetURL=http://localhost:58201/test

file.type=BIN

file.checkFileModificationInterval=300000

file.pollInterval=300

file.processingMode=archiveWithTimestamp

file.archiveDir=/test_out/arc

XI.QualityOfService=EO

file.numberOfMessageTypes=1

file.messageAttributes=name

XI.SenderService=test_snd

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

XI.ReceiverService=test_rcv

file.nestleBadMsgDir=/test_out/bad

file.sourceDir=/test_out

file.sourceFilename=.

Do the needful help asap.

Regards,

Prakash.

chitti_prakash
Employee
Employee
0 Kudos

Hi swarup,

But using OS command how can we rename /archive that file?

Module means any Custom Module or wat?

Following are the channel configurations used in File To File scenario.

File Sender :

version=30

mode=XMB2FILE

XI.httpPort=58201

XI.httpService=/test

XI.ReceiverAdapterForService=test_rcv

file.numberOfMessageTypes=1

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

file.type=BIN

file.targetDir=/test_inb

file.targetFilename=unusedbutreq

file.writeMode=fromHeader.ext

file.createDir=0

file.nestleName=initial

file.writeMode=fromHeader.ext

file.nestleEXT=test

file.nestleFileOverwrite=False

File Receiver :

version=30

mode=FILE2XMB

XI.TargetURL=http://localhost:58201/test

XI.NestleTargetURL=http://localhost:58201/test

file.type=BIN

file.checkFileModificationInterval=300000

file.pollInterval=300

file.processingMode=archiveWithTimestamp

file.archiveDir=/test_out/arc

XI.QualityOfService=EO

file.numberOfMessageTypes=1

file.messageAttributes=name

XI.SenderService=test_snd

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

XI.ReceiverService=test_rcv

file.nestleBadMsgDir=/test_out/bad

file.sourceDir=/test_out

file.sourceFilename=.

Do the needful help asap.

Regards,

Prakash.

chitti_prakash
Employee
Employee
0 Kudos

Hi swarup,

But using OS command how can we rename /archive that file?

Module means any Custom Module or wat?

Following are the channel configurations used in File To File scenario.

File Sender :

version=30

mode=XMB2FILE

XI.httpPort=58201

XI.httpService=/test

XI.ReceiverAdapterForService=test_rcv

file.numberOfMessageTypes=1

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

file.type=BIN

file.targetDir=/test_inb

file.targetFilename=unusedbutreq

file.writeMode=fromHeader.ext

file.createDir=0

file.nestleName=initial

file.writeMode=fromHeader.ext

file.nestleEXT=test

file.nestleFileOverwrite=False

File Receiver :

version=30

mode=FILE2XMB

XI.TargetURL=http://localhost:58201/test

XI.NestleTargetURL=http://localhost:58201/test

file.type=BIN

file.checkFileModificationInterval=300000

file.pollInterval=300

file.processingMode=archiveWithTimestamp

file.archiveDir=/test_out/arc

XI.QualityOfService=EO

file.numberOfMessageTypes=1

file.messageAttributes=name

XI.SenderService=test_snd

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

XI.ReceiverService=test_rcv

file.nestleBadMsgDir=/test_out/bad

file.sourceDir=/test_out

file.sourceFilename=.

Do the needful help asap.

Regards,

Prakash.

chitti_prakash
Employee
Employee
0 Kudos

Hi swarup,

But using OS command how can we rename /archive that file?

Module means any Custom Module or wat?

Following are the channel configurations used in File To File scenario.

File Sender :

version=30

mode=XMB2FILE

XI.httpPort=58201

XI.httpService=/test

XI.ReceiverAdapterForService=test_rcv

file.numberOfMessageTypes=1

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

file.type=BIN

file.targetDir=/test_inb

file.targetFilename=unusedbutreq

file.writeMode=fromHeader.ext

file.createDir=0

file.nestleName=initial

file.writeMode=fromHeader.ext

file.nestleEXT=test

file.nestleFileOverwrite=False

File Receiver :

version=30

mode=FILE2XMB

XI.TargetURL=http://localhost:58201/test

XI.NestleTargetURL=http://localhost:58201/test

file.type=BIN

file.checkFileModificationInterval=300000

file.pollInterval=300

file.processingMode=archiveWithTimestamp

file.archiveDir=/test_out/arc

XI.QualityOfService=EO

file.numberOfMessageTypes=1

file.messageAttributes=name

XI.SenderService=test_snd

XI.Interface=MI_test_out

XI.InterfaceNamespace=http://nestle.com/test

XI.ReceiverService=test_rcv

file.nestleBadMsgDir=/test_out/bad

file.sourceDir=/test_out

file.sourceFilename=.

Do the needful help asap.

Regards,

Prakash.

chitti_prakash
Employee
Employee
0 Kudos

Hi Swarup,

Sory for mis communication, configurations of sender and receiver channels are interchanged.

Regards,

SOorya.

Former Member
0 Kudos

Hi,

Below is the blog that will show you the way you can use OS commands.

/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions

PS Note : Refer SAP help for the usage of placeholders like %f (Filename) & %F (filename with complete path) etc.

Thanks

Swarup

chitti_prakash
Employee
Employee
0 Kudos

Hi Swarup,

THank for your reply.

But the scenario here is in J2SE AE but not in J2EE Engine.

I need to solve the issue in J2SE AE File to File scenario.

Please do the help asap.

Regards,

Soorya

Former Member
0 Kudos

Hi,

Ohhhh thats the point you are using J2SE AE...

That should not be the problem. You will have stand alone Adapter for this. ohh...but you won't be able to use the shell script, so OS commands can't work out.

Best way to use processig mode as setAttribute.

After file processing attribute will be set as read only and files with write mode will be processed further.

file.processingMode=setAttribute

Or

With J2SE AE, rather you can use java classes to modify the payload. In case of J2EE we need custom adapter module..

But will nto suggest this option....as it will increase the complexity for this small change.

Thanks

Swarup

Answers (1)

Answers (1)

former_member187339
Active Contributor
0 Kudos

Hi,

Try using this:

file.checkFileModificationInterval

http://help.sap.com/saphelp_nwpi71/helpdata/EN/0d/00453c91f37151e10000000a11402f/frameset.htm

Also when you read the file either archive or delete it

Regards

suraj

chitti_prakash
Employee
Employee
0 Kudos

Hi Suraj,

Even after using it, I am facinf the same problem.

Unable to find the root cause of the issue.

Is it possible for run the same scenario at your side and confirm whether the file is processing more than once

if there is restart of the adapter in between the configured interval.

Please do the needful.

Thanks,