cancel
Showing results for 
Search instead for 
Did you mean: 

missing processing details for custom adapter

Former Member
0 Kudos

Hello PI experts,

I am developing a custom adapter (not an adapter module) for a PI 7.0. I've started with the sample adapter provided by SAP and have now implemented the functionality that I need. Everything works with one exception:

I get no processing details for messages in the sender channels (please see attached screenshot). But I do get processing details for the receiver channels.

The trouble is that this is the exact behavior of the sample adapter, so my example is already "broken" and I have no idea which code I need to add where. All other adapters that I know of show processing details for both directions.

Please, can anyone tell me what I need to program or configure in order to get processing details for messages in the sender channels (please see attached screenshot)?

Thank you very much,

Sven

[http://noart.files.wordpress.com/2009/05/missing_message_details.jpg]

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> The trouble is that this is the exact behavior of the sample adapter, so my example is already "broken" and I have no idea which code I need to add where.

Now I see. This isn't an issue of your adapter, but an issue of the sample adapter. You are right. The sender channel is not coded correctly.

I have addressed that issue to development. I am not able to solve this myself

Regards

Stefan

Former Member
0 Kudos

> Now I see. This isn't an issue of your adapter, but an issue of the sample adapter. You are right. The sender channel is not coded correctly.

>

> I have addressed that issue to development. I am not able to solve this myself

Is it realistic to expect an answer soon? Will you post the reply from development here?

I am writing the adapter for a commercial customer and I expect to use the adapter in a productive environment. Could I open an OSS for this issue?

Thank you,

Bojidar

stefan_grube
Active Contributor
0 Kudos

In the sample adapter you find following code:


if (0 == raiseError.compareToIgnoreCase(ERR_ROLLBACK)) {
  audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, "Channel error mode is set to " + ERR_ROLLBACK + ". An Exception is thrown now to demonstrate a rollback behavior.");
  audit.flushAuditLogEntries(amk);
  TRACE.infoT(SIGNATURE, XIAdapterCategories.CONNECT_AF, "Channel error mode is set to " + ERR_ROLLBACK + ". An Exception is thrown now to demonstrate a rollback behavior.");
  // CS_PROCALERT START
  // The next lines illustrate how to create and push a process state that will trigger a SAP CCMS Alert to the SAP alert framework 
  // Use the process state if you intend to report channel (connection) oriented as well as message (processing) oriented alerts
  // In order to trigger alerts process status with ProcessState.FATAL must be pushed. Other process states will be displayed in the AAM monitor but
  // won't trigger alerts. 
  try {
    MonitoringManager mm = MonitoringManagerFactory.getInstance().getMonitoringManager();
    ProcessContextFactory.ParamSet ps = ProcessContextFactory.getParamSet().message(msg).channel(channel);
    ProcessContext pc = ProcessContextFactory.getInstance().createProcessContext(ps);
    mm.reportProcessStatus(this.adapterNamespace, this.adapterType, ChannelDirection.SENDER , ProcessState.FATAL, "Rollback triggered (as demo) since channel error mode was set to " + ERR_ROLLBACK, pc);
  } catch (Exception e) {
    TRACE.catching(SIGNATURE, e);
    TRACE.errorT(SIGNATURE, XIAdapterCategories.CONNECT_AF, "Process state propagation failed due to: {0}", new Object[] {e.getMessage()});
  }	
  // CS_PROCALERT END
  Exception e = new Exception("Sample rollback simulation test exception");
  TRACE.throwing(SIGNATURE,e);
  throw e;
}

Edited by: Stefan Grube on Jun 5, 2009 1:47 PM

stefan_grube
Active Contributor
0 Kudos

Add following lines direct to the code above:

else {
  // Write process information into channel monitor. 
  try {
    MonitoringManager mm = MonitoringManagerFactory.getInstance().getMonitoringManager();
    ProcessContextFactory.ParamSet ps = ProcessContextFactory.getParamSet().message(msg).channel(channel);
    ProcessContext pc = ProcessContextFactory.getInstance().createProcessContext(ps);
    mm.reportProcessStatus(this.adapterNamespace, this.adapterType, ChannelDirection.SENDER , ProcessState.OK, "File " + inFileName +" processed", pc);
  } catch (Exception e) {
    TRACE.catching(SIGNATURE, e);
    TRACE.errorT(SIGNATURE, XIAdapterCategories.CONNECT_AF, "Process state propagation failed due to: {0}", new Object[] {e.getMessage()});
}

The receiver channel gets the corresponding messages from adapter framework, but for the sender channel the adapter has to push the information.

This is necessary to enable the sender adapters to provide information without having a message.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

This code works as expected. I have placed this code in SPIManagedConnectionFactory class.

But I'm getting AdapterNotRegisteredException.

Please help me to solve this. Here is how i'm using


MonitoringManager mm = MonitoringManagerFactory.getInstance().getMonitoringManager();

            try{

                //Processing logs for Inbound Messages

                Channel channel = LookupManager.getInstance().getChannelByChannelName(

                     fromParty, fromService, cp.getChannelName(),

                    binding.getAdapterType(), binding.getAdapterNamespace());

                ProcessContextFactory.ParamSet ps = ProcessContextFactory.getParamSet().message(

                    msg).channel(channel);

                ProcessContext pc = ProcessContextFactory.getInstance().createProcessContext(

                    ps);

                mm.reportProcessStatus(

                    binding.getAdapterNamespace(),

                    binding.getAdapterType(),

                    ChannelDirection.SENDER,

                    ProcessState.OK,

                    msg.getMessageId() + " processed",

                    pc);

               

            }catch(Exception e){

                //Processing Logs for Inbound Messages

                mm.reportProcessStatus(

                    cp.getChannelName(),

                    cp.getRequestName(),

                    ChannelDirection.SENDER,

                    ProcessState.ERROR,

                    "An error occurred when transfering the message to XI AF MP with the message: {0}!"+e.getMessage());

            }

Thanks,

Chaitan

Answers (2)

Answers (2)

Former Member
0 Kudos

Kindly check the below link

this Scenario will give the overall information about the J2EE Adapter Module Development & Sender/Receiver Module Configuration.

[https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/8690] [original link is broken] [original link is broken] [original link is broken];

stefan_grube
Active Contributor
0 Kudos

Check if the correct type and namespace of the adapter is mentioned in SPIManagedConnectionFactory.java

Check the adapter meta data as well.

Regards

Stefan

stefan_grube
Active Contributor
0 Kudos

Btw: In your screen shot you filter for channel name, so of course only one channel is displayed. You should filter for adapter type.

Former Member
0 Kudos

Hi, I'm working together with Sven on the custom adapter, so I'll respond...

> Check if the correct type and namespace of the adapter is mentioned in SPIManagedConnectionFactory.java

What is the correct type and namespace?

In ra.xml of the META-INF directory of the rar-file I have the following lines:


      <config-property>
        <config-property-name>
          addressMode
        </config-property-name>
        <config-property-type>
          java.lang.String
        </config-property-type>
        <config-property-value>
          CPA
        </config-property-value>
      </config-property>
      <config-property>
        <config-property-name>
          adapterType
        </config-property-name>
        <config-property-type>
          java.lang.String
        </config-property-type>
        <config-property-value>
          SMQ
        </config-property-value>
      </config-property>
      <config-property>
        <config-property-name>
          adapterNamespace
        </config-property-name>
        <config-property-type>
          java.lang.String
        </config-property-type>
        <config-property-value>
          <a href="http://planbusiness.de/gesis/xi/XI/smq" TARGET="test_blank">http://planbusiness.de/gesis/xi/XI/smq</a>
        </config-property-value>
      </config-property>

and I have a trace in the start() method of the SPIManagedConnectionFactory which tells me that the addressMode is CPA, adapterType is SMQ and the adapterNamespace is http://planbusiness.de/gesis/xi/XI/smq. So ra.xml is being read correctly.

> Check the adapter meta data as well.

What exactly should I be looking for? A name-mismatch? A missing property? Something else?

Can you think of a reason why I am getting message details for the receiver channels but not for the sender channels? The sample (file) adapter from SAP (which I used as a starting point) behaves in the exact same way -- there are message details only for the receiver channels.

Thanks in advance,

Bojidar

Former Member
0 Kudos

Hallo Stefan,

> Btw: In your screen shot you filter for channel name, so of course only one channel is displayed. You should filter for adapter type.

You are right of course, but we are filtering once for the sender channel and once for the receiver channel. The result is the same: there are message details for the receiver channels and no details for the sender channels.

Thanks in advance,

Bojidar