cancel
Showing results for 
Search instead for 
Did you mean: 

Java-only, Component based message alerting - loopback to sender system

Former Member
0 Kudos

Dear guys,

we are using the alert framework availbale on PI 7.11 to notify the sender system if there is an alert for specific interfaces. In that case a customer function module is called giving the message id of the request message (message is sent via ABAP proxy). As a result the according entry in customer table is updated.

The implemntation is based on the BADI ALERT_MODIFY_TEXT and uses the standard function module ALE_BAPI_GET_UNIQUE_RECEIVER to determine the system /rfc destination to send the alert notification.


This solution works fine so far.


As PI 7.11 dual stack is not the latest release, we are thinking of upgrading to current PI/PO release. In this context also shift to java-only installation is contemplated which will need an alternative solution for the described alert/error notification loopback.


Are there any possibilities analog to BADI to implement such a solution?

What are your approaches regarding this requirement in the context of java-only?


Any help/thoughts appreciated.


Best regards,

Jochen

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

Hi Jochen - You can make use of the "AlertRetrieveAPI" to read the alerts and call the bapi to send this information.

Have a look at the below blog for more details..

In your case instead of sending email, you would call the BAPI..

Former Member
0 Kudos

Hi Hareesh,

thanks for your reply.

I went thorugh the blog and it seem that this approach should work, but some questions arises:

  • following this approach alerts are consumed according to the given interval and not in "real time" when error occurs, today solution using BADI is "real time" - if possible I would prefer "real time" solution
  • request message for fetching alerts has two parameters cosumerId and maxAlerts. I am not sure what to put in maxAlerts because may be all available alerts should be fetched at once .. how to implement this?
    sample: there are 100 errorneous messages and therefore 100 alerts have been created (hopefully) when I run the interface with maxAlerts=10 only 10 alerts got fetched and the others will be wait for the next interval, so it will take 10 intervals to get all alerts but in the meanwhile maybe additional errors arises to the backlog is constantly growing up ... or do I miss anything?
    an separate service determine the actual alert count would be helpful to provide the correct value for maxAlerts, this have to be called beforehand
  • In history I saw emails generated by the standard alert consumer which only contain details for the first alert, in my case I need details especially the message id for all errorneous messages

what do think on these questions?

Best regards

Jochen

former_member184720
Active Contributor
0 Kudos

Hi Jochen -


following this approach alerts are consumed according to the given interval and not in "real time" when error occurs, today solution using BADI is "real time" - if possible I would prefer "real time" solution

>>> The only possible option i see here is reducing the polling interval in the file channel

-----------------

request message for fetching alerts has two parameters cosumerId and maxAlerts. I am not sure what to put in maxAlerts because may be all available alerts should be fetched at once .. how to implement this?


>>> Your assumption is correct. 

I don't see any service to retrieve the alert count. May be you can give the maximum count and reduce the polling interval.

--------------------


In history I saw emails generated by the standard alert consumer which only contain details for the first alert, in my case I need details especially the message id for all errorneous messages


>>>You'll have the details of all the messages(if you set the max alerts to 10 then you would get the information of all the 10 messages in that email)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

>>What are your approaches regarding this requirement in the context of java-only?

I would suggest you to schedule jobs like this:

>> alerts are consumed according to the given interval and not in "real time" when error occurs, today solution using BADI is "real time" - if possible I would prefer "real time" solution

Check this:

>>an separate service determine the actual alert count would be helpful to provide the correct value for maxAlerts, this have to be called beforehand

I haven't tried it but i think u can do that, since these consumers are nothing but JMS queues only so i think there will be a method to read number of alert counts.

>>In history I saw emails generated by the standard alert consumer which only contain details for the first alert, in my case I need details especially the message id for all errorneous messages

If ur max alert parameter is greater than 1 then u should see multiple alert text  (along with message id and other details) in ur email message.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

at the moment I think of following approach.

  • Defining a specific AlertConsumer for this scenario.
  • Implement a Z report in sender system which runs periodically and request for new alerts (sync interface) e.g. maxAlerts = 10
  • continue alert query as long as alert result table is not empty respectively alert result table count = 10
  • in response mapping msgId are extracted and returned as table to sender
  • sender knows failed msgId and processes accordingly e.g. update of table entries

I think this approach should work quite well, but there is another open point.

In this specific scenario includes a message split, so that from 1 source message 2 result messages are created. The sender system only knows the messageId of the source message, so for errors occuring after this message split e.g. file adapter errors, the alert will have the child messageId which is not known by the sender.

Therefore I have to determine the parent message id out of the child message id and report it back to the sender system. In the actual BADI implementation this is done by querying the ABAP table SXMS_MULTIM_REF

But how could this be achieved during response mapping e.g. graphical message mapping when running the scenario as java only (integrated configuration)

Is there an equivalent table in AEX and if so how to access it best form mapping?

Any thoughts on that?

Best regards,

Jochen

Former Member
0 Kudos

Hello,

>>at the moment I think of following approach.

Ur approach looks OK to me, so instead of creating/scheduling custom jobs (by consuming WS in PI) u would ask ur sender system to consumer alert retrieve API WS and query alerts - this way ur task would be much more easy.

>>I think this approach should work quite well, but there is another open point.

I think there should be a table in PI which maintain this reference, but i am not aware of that. Will try to search and will apprise u in case i find something.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit

thanks for your reply and feedback.

I also searched in the Java DB schema and found the field PARENT_MSG_ID in table BC_MSG

I setup a little test scenario on a 7.31 java only, and this field holds actually the relationship between child and parent message.

Regarding usage of Java DB Table I found few threads on SCN

I am not sure which is the best, especially regarding connection handling.

If possible I want to reuse connections instead of creating new ones.

Do you have any experience on that?

Hopefully I find some time for testing one of this approaches.

Best regards,

Jochen

Former Member
0 Kudos

Hello,

No, i haven't worked on that, but i remeber sometime back (1-2 years back) seeing a blog on SDN on a similar lines (querying java tables to get message status) and if i am not wrong u can resue connections, so i think u have to explictly create connections inside ur code to access that table.

Thanks

Amit Srivastava

former_member184720
Active Contributor
0 Kudos

Hi Jochen - Can you try with the method "" under the service "AdapterMessageMonitoringVi" in wsnavigator by giving parent ID and see if it extracts the child messages ..?

Former Member
0 Kudos

Hi Amit,

the approach schedule a report at sender application side seems to be feasible, but I still would prefer a PUSH approach, which will trigger directly an additional PI message in case new alert for this scenario is triggered instead of having a job which polls for new alerts every x min.

Because alerts are nothing more than a JMS text message and alert store is JMS queue, I think of using JMS sender adapter to fetch new alerts for specific alert consumer as soon as a new one is triggered. Do you think using JMS sender adapter to will fullfil this requirement.

I haven't used JMS yet, so I am not sure if this will help prevent schedule unnecessary jobs and provide an "real time" processing (loop back) to sender system.

In SAP help there two modes for JMS Connector

  • message listener
  • message polling

I appreciate your feedback on this approach.

Best regards

Jochen

Former Member
0 Kudos

Hello Jochen,

I think you are complicating your task. SAP has already provided u the API so u can consume it instead of directly querying JMS stores using jms adapter etc. . In addition to that, just think the number of time ur alert interface will be triggered (for each alert) which could hamper ur normal interface processing.

Personally speaking, i would never go with such a approach where i have to create an alert interface per consumer, and instead of that i would prefer to create jobs which will run in the background.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit

in the meanwhile I got my hands on testing JMS access to alerts.

I was able to display created alerts using Hermes JMS, but unfortunately not successful in reading the alerts using JMS sender adapter.

I am not sure if the created queues have special type which could not be accessed by JMS sender adapter.

my sender configuration:

jndi lookup con factory = jmsfactory/default/QueueConnectionFactory

jndi lookup name queue = jmsqueues/alertingVP/jms/queue/xi/monitoring/alert/ALERT-TO-MAIL

name jndi initial con factory = com.sap.engine.services.jndi.InitialContextFactoryImpl

jndi server = host:5xx04

user = same as hermes is using

pw = same as hermes is using

error in developer trace

Error starting channel: com.sap.aii.af.service.cpa.impl.object.ChannelImpl@786fdf02 with ID=516dfae6542f3d1b9c33cb5ef01c87cf due to com.sap.aii.adapter.jms.api.connector.ConnectorException: Error creating message consumer: javax.jms.InvalidDestinationException:  [ com.sap.jms.client.destination.JMSQueue@4c, destinationId = 76, name = jmsqueueximonitoringalertALERT-TO-MAIL, vpName = alertingVP, type = Queue ]


name seemed to be the translated name which is also displayed in NWA -> JMS Server Configuration in the details of the wanted JMS queue


As I am new to JMS usage there might some configuration error causing the error or is not possible to access this queues by JMS adapter generally?


Any help appreciated.


thanks,

Jochen