cancel
Showing results for 
Search instead for 
Did you mean: 

Adapter Scheduling - Alert if file not available

Former Member
0 Kudos

Hi,

I have scheduled a file adapter to poll at a certain time on a daily basis. I have scheduled it in such a way that the adapter will poll 3 times @ 5 minutes interval. It's working fine.

But what I need is, when the file is not available even after it polls 3 times @ 5 minutes interval, the adapter has to raise an alert.

How do I achieve this.

Thanks in advance.

Bala

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Here is cheap workaround for you:

- Write perl/shell script to check file (search google you find many such script)

- Schedule it for 5 minute using Cron

Adapter alert:

If you want your adapter to give alert then create dummy file with custom error information and raise alert based on centent of file.

Alert:

- Modify abovesaid script and send mail to fixed receipent that file is not available

- Modify abovesaid script and write information in syslog (user logger command on unix)

I am using similar solution for few interface and it is working fine. If you need more information please let me know.

Regards,

Gourav

---

<i>Reward points if it helps you</i>

Answers (3)

Answers (3)

henrique_pinto
Active Contributor
0 Kudos

Guys,

let me know if u agree or not.

Even if there is no file to be polled, the CallSapAdapter bean will always be executed.

Then, maybe, just maybe, a custom adpater module could check if you have any message objects in the inputModuleData, and if not, you could take proper actions.

I don't know if it will work, but I think it is worth a shot.

Regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

Henrique,

Good to see that there is still a lot of interest in this thread

From the blog,

/people/siva.maranani/blog/2005/05/25/understanding-message-flow-in-xi -- Understanding message flow in XI,

<i> 3 . This message is then sent to module processor for further processing. During the process of sending the message to module processor, the message “Application attempting to send an XI message asynchronously using connection AFW” is logged.</i>

I think the CallSAPAdapterBean is called only after the file is picked by the file adapter and not every polling interval. I might ewven be wrong , but that is what I have understodd from this blog and also my understanding of how adapters work in XI.

The message / File is picked up and only after that the bean will / should be called.

Regards

Bhavesh

henrique_pinto
Active Contributor
0 Kudos

Bhavesh,

you are right, from that blog we may think that the adapter module will only be called after you successfully poll the file.

However, reason with me: some java program will have to be called to execute the polling. And where do we enter the polling parameters (polling interval, source address etc)? In the <b>adapter parameters</b> tab. And since they are adapter parameters, it is logic to expect that they will be used by the adapter program.

I don't know if the adapter program will proceed with the other module processors execution since no message was created, though I do think that the act of queuing the message in the Integration Server and executing other modules are two independent tasks and hence the other modules <b>could</b> be executed even if no message is available ("could" doesn't mean the "are").

As I said, I'm not sure it'll work.

I only think its worth a shot, at least to be sure.

As for the execution of the CallSapAdapter bean, one could set its trace level to debug and hence check if it is executed in Visual Admin log at every 5 minutes or only when there are available files.

Regards,

Henrique.

PS: aint it like 1 AM in India? You SDN junkie! 😄

Former Member
0 Kudos

hi bhavesh,

i have come to bug you all again.

Please refer to this blog on "Schedule Your BPM":-

/people/siva.maranani/blog/2005/05/22/schedule-your-bpm

Will my requirement of "<u>trigger an alert if the file is not found at the sender directory</u>" be achieved if I follow the above blog.

kindly suggest. thanks. bala

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

Still not sure I follow the Faulty message logic at all.

How do you determine that the file is faulty and how is it sent to the Error folder?

The same issue that you face with my earlier solution you will face with the schedule the BPM as welll for the faulty file issue.

Regards

bhavesh

Former Member
0 Kudos

hi bhavesh,

the sender file adapter has an option where Faulty Source Files can be moved in a separate directory (PI 7.0 - SP11). Faulty means a malformed structure in the file. So when the sender file adapter polls the source directory and if it finds that the source file has got a malformed structure, it will treat the file as faulty file and move it into the separate directory.

thanks. bala

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

That was a new info for me

Now, I get the problem.

For faulty files you do not want an Alert to be triggered and my solution would trigger the alert anyways ( for both faulty files and when no file found ).

Workarounds,

1. Do not use this new feature. let the fault file come into XI.

2. Check if this is a faulty file in the mapping and then set some other flag in the ZTABLE.

Not sure how feasible this is though.

But, the BPM scheduling will also have the same problem and so you might have to work something outo n these lines.

regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

in your reply, you said that

>> But, the BPM scheduling will also have the same problem

Why will the BPM have the same problem. It is only triggering the client proxy.... please elaborate.

thanks in advance. Bala

bhavesh_kantilal
Active Contributor
0 Kudos

To answer your question I will ask you another question.

If you are shcedule your BPM, how will you achieve your requirement?

Regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

The idea of "Scheduling a BPM" was suggested by the client. Even I was wondering how this will serve the purpose because, the scenario which I am dealing is a File to Proxy(inbound) whereas the blog --> "Scheduling a BPM" talks about outbound proxy.

I anyways thought of posting this in SDN to get more clarity so that I can justify the client that even when scheduling a BPM, the requirement of Alert Functionality (trigger alert when the source file is not found after a specified interval) is not met.

What the client says is that--> To perform the alert (when the source file is not found after a specified interval) follow the blog --> Scheduling a BPM - /people/siva.maranani/blog/2005/05/22/schedule-your-bpm

- Schedule a daily job at required start time.

- The first job will start a BPM (through a proxy interface) which next step will be a fork with two branches. In one of them the BPM will wait for the inbound interface and the other one for a 15 minutes wait step or a second step scheduled at the deadline time.

- If the first branch ends before, nothing happens, if no, the alarm could be raised.

bhavesh, please comment your views on this.

thanks. bala

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

The same issue with my approach exists here as well.

What happens when the faulty file is moved by the sender file adapter to the errror folder?

In this case , the file was available, and still the BPM would not have received the file as the file is moved by the sender file adapter to the faulty folder and thereby the alert would still be triggered. Just as the problem existed with my approach for faulty files, the same problem exists here for the BPM scheduling.

Hope this clears things up.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

if am not wroing i hope this was already discussed in this thread that the bpm will get triggered only when the message is recv inside the recv step of bpm

Former Member
0 Kudos

Hi Bala,

I have the same issue now can you please let me know were you able to achieve this?

Thanks,

Bhargav

Former Member
0 Kudos

Hi Bhargav

Run an OS command (Script) before polling. If files are not there raise alert from Script and if its there then pick the file using file adapter.

Thanks

Gaurav

Former Member
0 Kudos

Hi Gaurav,

Any idea on the OS Command Script?

Thanks,

Bhargav

Former Member
0 Kudos

Hi

Check the files are there or not in script and enhance it with this

#!/usr/bin/perl -w

use Net::SMTP;

$smtp = Net::SMTP->new("mail.domain.com");

$smtp->mail("mail\@domain.com");
$smtp->to("mail\@domain.com");
$smtp->data();
$smtp->datasend("File is not present in folder\n\n");
$smtp->dataend();
$smtp->quit();

Change the values to whom you want to send exception text.

Thanks

Gaurav

prabhu_s2
Active Contributor
0 Kudos

bala

i hope that if the file is not present in the folder and when the polling interval strikes the CC (sender) will have an message logged and if the alerts are configured then it would be caught.....need to check on it

Message was edited by:

Prabhu S

bhavesh_kantilal
Active Contributor
0 Kudos

Currently such a feature is not available in standard

Let me know if you need a dirty workaround.

Regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

pls tell me the work-around.

thanks in advance.

bala

Former Member
0 Kudos

Hi,

In general , we can have proxy for this type of things,

create a proxy and use in a program call and schedule it. if the source file is not there then we can raise alert also.

I hope it is clear.

Regards

Chilla

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

In your interface if the file is picked up in the mapping you can have a RFC lookup that will update some ZTABLE in XI to let you know that the interface has run in XI.

You can write a report in XI that will be scheduled after the file adapter has been stopeed and this will then chekc for entries in the ZTABLE and if no entires, will trigger the alert .

Prabhu~ Adapter Scheduling does not trigger any alert / audit message if there is not file. All it does is activate and deactivate the adapter at the appropriate time.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

thks for the info bhavesh. i havent checked it yet.

prabhu_s2
Active Contributor
0 Kudos

@ bhavesh,

one quick clarification...does it happens for all polling methods?

Former Member
0 Kudos

hi bhavesh,

that's a fantastic work-around.....

points awarded.

thanks. bala

Former Member
0 Kudos

HI,

See , using thr RFC lookup for every time updating the Ztable is good solution , But in performance wise not suggested .

because say for example if have 1000 messages are in your source , every time for each message it should update the Ztable. it is not suggested./ say for example the respective file is not there , that time only you are going togenerate the entry in Ztable , even that time also . i mean the xml precess has tostart and goto message mapping and again come back to rfc lookup and adding entry in Ztable.the for every 5 min search and send , it is performance issue . i hope you understand ..

Best solution is maitain the Sender side proxy , use ABAP proxy , to check the folder itself and if the folder is not containing the file then the respective function module will get trigger to raise an alert (SAP Alert management).

maintain a program to call the proxy whenever file existed. that the xml process will start ..no performance issue ,

Regards

Chilla

Former Member
0 Kudos

hi bhavesh,

the work around which you suggested is not agreed by the client due to some inconsistencies.

can i use a BPM to achieve this.

thanks in advance. bala

prabhu_s2
Active Contributor
0 Kudos

yes u can use BPM for this

Former Member
0 Kudos

hi Prabhu,

can u explain step by step on how to achieve this with BPM.

thanks. bala

bhavesh_kantilal
Active Contributor
0 Kudos

Prabhu,

I would also like to know how you can use a BPM for this.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

using a wait step for this....i think it might work or did i understand the req wrong?

bhavesh_kantilal
Active Contributor
0 Kudos

But what will the trigger for the BPM will be?

If the file adapter does nto find the file ater 3 polling interval, how will be the BPM be started?

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

okie if the file is not found, the CC moni in RWB will report an error. in this case the configured alerts with rules not filtered triggers an alert?

bhavesh_kantilal
Active Contributor
0 Kudos

> okie if the file is not found, the CC moni in RWB

> will report an error. in this case the configured

> alerts with rules not filtered triggers an alert?

The sender file adapter will never error out if the file is not found. It will continue polling without any errors.

If there is going to be an error in the file adapter for every polling interval just because the file is not found, all my production XI boes will have thousands of alerts.

The file adapter or any polling based adapter never errors out because data is not available at the polling interval. It will just poll the next time and search for the data the next time.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

okie this was my doubt earlier which i had posted in this thread. does it applies for all pooling methods? i'm not able to check this for file now.

bhavesh_kantilal
Active Contributor
0 Kudos

It does apply to all adapters.

No adapter on the sender side will error out becuase data that it is looking for is not available.

@ Bala~

I dont think there is anyother solution than using the RFC report option i discussed earlier.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

and using BPM we will check if the message is empty for every 3 min for example and if yes then raise an exception....can this be configured in the bpm?

prabhu_s2
Active Contributor
0 Kudos

but for JDBC scenario which i'd configured long before the CC monitoring reported log when it was not able to pick any data. this was tracked using alerts

bhavesh_kantilal
Active Contributor
0 Kudos

Nope. There must have been an error in the Sender JDBC adapter ( maybe query issue ) but it would not have erroered out just because there is no data that satisfies the Select Query.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

But how will the trigger to the BPM happen?

Can you actually list down the steps for your BPM design such that if the files are not found in 3 polling intervals a alert is raised.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

have a recv step and a loop to collect the message. this will timed and once timed out it will go to the next step where in the mapping we check if the message is empty and raise an exception. if message is found then we can route with the normal process.....will this step help?

bhavesh_kantilal
Active Contributor
0 Kudos

When do you think will this BPM get instantaieted in the run time?

Until and unless the receieve step does not receieve the message inside the BPM ( from the Sender File adapter ) the BPM will not even become active in the runtime. And so, the loop will also not come into picture.

All BPM processes have to be started with a Receive Step and this is the onyl way a BPM will get instantiaed. In this case, if there is no file, the BPM will not get instantiated and so no alert will be triggered.

Regards

Bhavesh

prabhu_s2
Active Contributor
0 Kudos

and regrading to the prev post on JDBC yes u r right, the alert was raised when the connection string was wrong. just now checked it. we did it for simulating errors at sender side and checking alrt config.

prabhu_s2
Active Contributor
0 Kudos

hey...yes. i didnt think on this point ....thkx for refreshing it

Former Member
0 Kudos

hi bhavesh and prabhu,

let me give more clarity to the scenario.

The scenario is file to proxy (inbound). XI will poll the source system to pick the file and transforms the data as per the mapping and calls the inbound proxy to update the ZTABLES in the target system. currently (without using BPM) the interface is running fine except that the requirement for alert functionality is not implemented when the file is not available at source.

as per my understanding, the BPM will have a Fork step with two branches. one of the branch will wait to pick the file and the other branch will wait for 15 minutes till the deadline time. If the first branch ends before, nothing is done, if no, the alert is raised. is this approach right.

please suggest. thanks bala.

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

This will nto work for the exact reason I have pointed to prabhu.

You can have a dealine brach etc in a BPM, but this BPM will get active ONLY when the Receieve Step in the Fork becomes active , ie. the file is received.

If you still not convinced, just give it a short. Make the deaadline as 1 minute and check if the deadline branch is triggered, it will not be, as the BPM would not have become active at all.

Regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

Please refer to this blog on "Schedule Your BPM":-

/people/siva.maranani/blog/2005/05/22/schedule-your-bpm

Will my requirement be achieved if I follow the above blog. Please site reasons why if it does not meet my requirement.

Thanks in advance. Bala

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

if the client does not agree to the earlier approach I am pretty sure the client would nto agreee to this approach of using proxies to schedule your BPM.

This approach has a BPM with Proxies while the earlier design i suggested used a RFClookup and a Indenpendent RFC report.

Regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

the client did not agree to the earlier approach because it seems there are some inconsistencies. why because, if the file is placed in the directory and due to malformed structure of data, the adapter polls it and places the same in the error directory (under the pretext of faulty source files). so when the report is executed, there will not be any records in the table and the program will raise an alert. but strictly speaking, the file is put but polled and kept in the error directory and therefore no records are updated the target table. this is the discrepancy with the approach. but otherwise, the work-around which you suggested was a good one.

will the approach of BPM with Proxies satisfy the requirement. i wanted a justification to tell the client. can you elaborate whether it is possible to implement using the help of the above blog.

waiting to hear from you. thanks. bala

Former Member
0 Kudos

hi bhavesh,

what happened. i know that I am putting a lot of questions. but all these are for better understanding.

will the approach of BPM with Proxies satisfy my requirement.

thanks in advance. bala

bhavesh_kantilal
Active Contributor
0 Kudos

Bala,

Did not notcie you had updated the thread.

Am actually lost in the incosistency of the earlier solution. Can you repharse it.

There are 3 cases that I see,

1. File is available and is a valid format. So the RFC Lookup in the mapping sets the flag in the table that the file has been read. No Alert needs to be generated in this case.

2. File is available and is inavlid. What needs to be done in this case? Should alert be triggered? Should it not be triggered. What is the existing flow when the file has an error in it?

3. File is not available, the earlier solution suggested would work.

Case 2 depending on what the requriement is for the Error File the report can be tweaked and handled. So if you can elaborate it would be helpfu.

Regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

pls find my reply :-

1. File is available and is a valid format.

The file adapter will archive the file and move the file(with timestamp) to the archive folder. Data will be updated in the target system ZTABLES. No Alert needs to be generated in this case. This is implemented & working fine

2. File is available and is inavlid. What needs to be done in this case? Should alert be triggered? Should it not be triggered. What is the existing flow when the file has an error in it?

If the file is not valid (bad structure), the file adapter moves the file to Error directory and raises an alert "Error in File". Data is anyways not passed to XI and therefore ZTABLES are not updated. But in the earlier approach which you suggested, the report program will raise an alert because the tables are not updated. But actually, the file is put and moved to error directory. This does not mean that the file is not placed in the folder at all.

3. File is not placed in the folder.

If the file is not placed in the folder, the file adapter should raise an alert "File not found".

I hope this gives clarity. thanks bhavesh, awaiting to hear from you.

bhavesh_kantilal
Active Contributor
0 Kudos

><i>the file adapter moves the file to Error directory and raises an alert "Error in File". Data is anyways not passed to XI and therefore ZTABLES</i>

How is it determined that the file is inavlid in this case? If this was done inside the mapping in XI, you can again use the same lokup concept and set a different flag for this.

In your case as there is someother program validating this file would it be possible to update the table from that program itself?

Regards

Bhavesh

Former Member
0 Kudos

hi bhavesh,

sorry, i got stuck in a meeting which is why a delayed response.

A file is determined invalid or faulty, if it has got a malformed structure. If the structure of the file is not in line with the structure of the message type, it is considered a faulty file.

File adapter has got an attribute to archive faulty source files. Just we need to click that option and provide the path of the fault directory, so that XI will move the faulty source file to that particular directory. So, the message does not pass into XI. The file adapter will raise an alert to the recipient.

Thanks. Bala