Skip to Content

Data Change Notification (DCN) sound impressive and when taking a closer look at the description, it looks like it is the best of both worlds:

  • Up to date data in the CDB
  • Minimum impact on the backend

Create MBO

First step is to create a MBO that is assigned to a cache group that uses DCN. Pick a service you want and create a MBO from it. I’m using my user web service published on Geronimo.

/wp-content/uploads/2012/09/dcn1_134398.jpg

The MBO is assigned to a cache group that uses DCN.

/wp-content/uploads/2012/09/dcn2_134444.jpg

From the MBO perspective, that’s all. The MBO is created with attributes and operations and assigned to a DCN policy. The MBO can be deployed on SUP.

Data Change Notification

Data Change Notification means that you have to take care for filling the cache database (CDB). While with the other policies SUP takes care of making sure that the data in the CDB is loaded from the backend, with DCN this is your task. When your application logic demands that data entered into the backend needs to be made available to the MBO, you have to write an application that does exactly that.

For sending data updates from the backend to SUP and the CDB you’ll need custom code. The data change notification is send to a servlet. This servlet runs on the SUP server and waits for connections under the location /dcn/DCNServlet (for basic authentication): http://server:8000/dcn/DCNServlet

As outlined in the SUP documentation, a DCN request has to follow a very strict and specific layout.

http://server:8000/dcn/DCNServlet?cmd=dcn&username=user&password=password&package=ProjectName:Version&domain=default&dcn_request={“pkg”:”dummy”,”messages”:[{“id”:”1″,”mbo”:”MBOName”,”op”:”:upsert”,”cols”:{values}}]}


Security

To be able to send data to the DCN servlet you need to be authenticated. When you now expect some fancy SSO or token stuff: nothing of that. Its plain simple HTTP authentication:

  • username and password or
  • base64

The actual data change send from the server to DCN servlet can be either with or without payload (once the data is send as a parameter added to the URL (GET) or as data in the request (POST)). SUP makes it simple to send the data: no REST, just a plain GET or POST. The communication is only between your backend and SUP. Depending on your infrastructure it depends if you should or have to use SSL for DCN communication.

You can access the DCN servlet using your browser to see if the servlet is running:

/wp-content/uploads/2012/09/dcn3_134445.jpg

In case you were wondering what kind of application server SUP is running on: it’s Jetty. Maybe sometimes SUP will run on Tomcat (or TomEE) or even NetWeaver AS Java.

DCNServlet requires a valid user. Make sure that the user you are passing in the argument list exists in the domain and security configuration and has the needed role. If not, you get this error message:

/wp-content/uploads/2012/09/dcn4_134446.jpg

Note that the MBO is deployed in a security domain called Android, the default supAdmin does not exist in this security configuration.

Loading data

Full request:

http://sup:8000/dcn/DCNServlet?cmd=dcn&username=android22&password=password&package=TestDCN:1.0&domain=default&dcn_request={“pkg”:”dummy”,”messages”:[{“id”:”1″,”mbo”:”TobiasMBO”,”op”:”:upsert”,”cols”:{“id”:”10″,”city”:”Brasilia”,”userName”:”testDCNUser”}}]}

When the use passed is valid, you get:

/wp-content/uploads/2012/09/dcn5_134447.jpg

Verify CDB

The response message states “success”. But how to know that it worked? Is the MBO updated? As it’s not always useful to create a mobile application just to know what the MBO returns, you can also analyze the content of the Cache DB. See the How-To document posted on SCN to see how to do so.

Executing the query:

/wp-content/uploads/2012/09/dcn6_134448.jpg

Result:

/wp-content/uploads/2012/09/dcn7_134449.jpg

That is exactly what was send to SUP. DCN is working!

While DCN is a great way to keep the CDB synced and minimizing the impact on the backend, it’s comes with some serious amount of work. Not only will you have to implement DCN for each MBO and trigger the data refresh. Each time you change the structure of the MBO you’ll have to adjust your custom code too. When you use one SUP server for DEV and QA, you really have to ensure that the DEV DCN code is not pushing data to the QA MBO. With good governance DCN gives you the most flexibility.

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Ibrahim Essa

    Dears ,

    I am trying to use DCN in my windows mobile application

    i built all required functions and programs in ABAP ,so now data change reflected directly in SUP CDB

    But the question now how i can handling SUP notification in device application ?

    and what are the changes in application code(c#)?

    Please help because i am very confused

    Thanks

    (0) 
  2. dheeraj chaudhary

    We have recenlty upgrade SMP2.3 to SMP3.0. DCN partilal upsert was working fine in 2.3 whereas it created the other field values as null in SMP 3.0. Can we get any alternate solution to handle such scenario..

    (0) 

Leave a Reply