Developer forum

Forum » Development » How to use Actitivity in Data Integration

How to use Actitivity in Data Integration

Martin René Plett Pedersen
Reply
Hello,

I created a Data Integration Activity class in Visual Studio using the templates downloaded for v8. I have build a .dll with this (along some other customizations) - and have copied it to the bin folder of the website.
Unfortunately I cannot figure out how to move on from this point. I cannot find any references to the activity in the admin interface - and therefore no way to actually run the activity. Unfortinately I cannot find any documentation on this either - so I am pretty stuck.
Can you helt me out on this?

Regards, Martin

Replies

 
Kim Søjborg Pedersen
Reply
 I would also like to see some documentation (code examples), generally on the new api. I would say documentation first, then code. That would make it much easier to be dw partner :)
 
Jonas Dam
Reply
 Hey,
 
I have attached a (very) rough "getting started" example of how to create a custom provider. Hopefully this should be enough to get you started, get your custom code to run within the Data Integration framework.
 
This document shows how to get the example/template code running.
 
We are working on more comprehensive documentation for this part of the API, and will put it up on the developer site in the comming months.
 
Regards, Jonas
 
Kim Søjborg Pedersen
Reply
 Okay thanks, then I will begin to suggest DW eCom to the customers in the comming months.
 
Martin René Plett Pedersen
Reply
Hey Jonas,

Thanx - can you point me to at download url of the Visual Studio templates including SourceProvider/DestinationProvider for Data Integration? I can only find a down load link for v 1.4.0.0 which does not seem to contain these templates.

Thanx Martin
 
Jonas Dam
Reply
Hi martin,

You are quite right.

There is now a version 1.5 available under downloads, which includes the  templates.

The person responsible has been kicked :)

/Jonas
 
Martin René Plett Pedersen
Reply
 Hi Jonas,

Thank you - I downloaded the new templates and installed them into my VS - no problem.

But I still cannot figure ouyt how this relates to the Dynamicweb.Integration.Activity class. As a short background this is a class with a few sql queries that should be executed after a dataintegration workflow which imports users and products for eCommerce. I got the class structure from Morten Snedker - but unfortunately no explenation on using it :-)

Thanx, Martin
 
Jonas Dam
Reply
 Hi,

Ok, I think you've found your way into the class structure that is used for the (old) import/export module, and not for the new Data Integration module.

The customProviders are not related to the Activity class at all.

As I understand you, you wish to run some SQL after an import has completed - is that correct?

 

The way to do that is to create a custom destination provider that inherits from the provider you wish to use: so if you wish to import data to DW using the Dynamicweb provider (which is the one that allows you to import users) you do the following:
* inherit from the Dynamicweb provider
* override the RunJob() function
* in your Runjob() function, call the base RunJob() function, check that it returns True (that the job succeeded)
* if it does, you run your custom closing/cleanup code.


This allows you to use the build-in code for the actual import, but follow it with your own custom code.

/Jonas

 
Thomas Larsen
Reply

I have tried to create a custom destination provider inheriting from the Dynamicweb provider, as described above.

Setting up the job works fine, but when i try to edit the job, i get the following error. 

[NullReferenceException: Object reference not set to an instance of an object.]
   Dynamicweb.Admin.DoMapping.Page_Load(Object sender, EventArgs e) in E:\Program Files (x86)\Jenkins\jobs\Release DW841\workspace\Dynamicweb.Admin\Admin\Module\IntegrationV2\DoMapping.aspx.vb:275
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

 

The code is as follow:

[AddInName("test.DataIntegration.Provider"), AddInLabel("test Dynamicweb DestinationProvider"), AddInDescription("test Dynamicweb DestinationProvider")]
    public class ExampleDestinationProvider1 : Dynamicweb.Data.Providers.DynamicwebProvider, IDestination
    {
        
        public override bool RunJob(Job job, string logFile)
        {
            if (base.RunJob(job, logFile))
            {
                //Clear storage

                return true;

            }
            return false;

        }
    }

 

Version: 8.4.1.2

 
Jonas Krarup Dam
Reply

Hi Thomas,

 

You have posted to a very old thread, and I only saw the post because someone else linked to it.

 

however, you can avoid the error by adding constructors as follows:

 public MyProvider()
        {
        }
        public MyProviderXmlNode xmlNode):base(xmlNode)
        {
           
        }

 

Regards, Jonas

 
Thomas Larsen
Reply

Hi Jonas,

Thanks for your reply, I have already done that myself :-)

But I have discovered a new problem, when inheriting from the dynamicweb destination provider and adding extra custom settings the constructor throws an exception (Unexpected node), because the DynamicwebProvider constructors validates the settings in the Xmlnode.

Is there a solution for this?

/Thomas

 
Jonas Krarup Dam
Reply

Hi Thomas,

you will have to implement the constructor that takes an XMLnode as input, instead of calling through to the base class.

you can see the current implementation in the code for the DynamicwebProvider (in  Dynamicweb.Data.Providers.zip which can be downloaded under downloads->sourcecode) - then you will have to add the code for your custom settings.

Regards, Jonas

 

You must be logged in to post in the forum