Skip to main content
KH1
Contributor
April 2, 2025
Solved

Service Factory - Data Management Step

  • April 2, 2025
  • 7 replies
  • 0 views

We're moving most of the Business Rules to Workspaces Assemblies under PV 8.4.
- We have several Extensibility Rules that are run by multiple Data Management (DM) Jobs like you.
- Hence, we included separate DM Step Services (DMSS) in the same Service Factory (SF).
- The result of this SF setup was chaos.
- We saw that launching one DM Job by a given DMSS in the SF will also launch other DM Jobs by their DMSS in the SF.

We couldn't find enough practical advice on the SF/DMSS setups in the Design Guide to overcome this chaos.
Pls share how to set up Data Management Step Services in a Service Factory to launch one Extensibility Rule/DM Job at a time.

TY.

Best answer by Henning

In addition to Daniel's response, I think it is good practice to use the service factory only as the initial router to point to a single service (file). In that service file I would apply the conditional logic.

In the below example, I call only Data Set and Component Service files from the SF and then apply all the conditional logic in those two files. The actual different data set and component code is then in files in my HelperFiles folder.

 

7 replies

Contributor
April 2, 2025

Hi KH1,

I feel like it would have to be an issue with your conditional logic within the assembly / DMSS class but I haven't actually used these yet so who knows. Do you want to post your code to see if we can spot anything?

Regards,

Daniel

KH1
KH1Author
Contributor
April 2, 2025
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName
Public Class _0_01_SF
Implements IWsAssemblyServiceFactory
 
        Public Function CreateWsAssemblyServiceInstance(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal workspace As DashboardWorkspace, ByVal wsasType As WsAssemblyServiceType, ByVal itemName As String) As IWsAssemblyServiceBase Implements IWsAssemblyServiceFactory.CreateWsAssemblyServiceInstance
            Try
                Select Case wsasType
                    Case Is = WsAssemblyServiceType.Component
                        'Return New WsasComponent()
 
                    Case Is = WsAssemblyServiceType.Dashboard
                        'Return New WsasDashboard()
 
                    Case Is = WsAssemblyServiceType.DataManagementStep
                        Return New Delete_Batch_Folders_Ex_S()
                        Return New Delete_Dim_Members_Ex_S()
                        Return New Direct_WF_Cube_Ex_S()
 
                    Case Is = WsAssemblyServiceType.FinanceCustomCalculate
                        Return New Act_Copy_Scenario_Fin()
 
                    Case Else
                        Return Nothing
                End Select
 
                Return Nothing
            Catch ex As Exception
                Throw New XFException(si, ex)
            End Try
        End Function
 
End Class
End Namespace
Contributor
April 3, 2025

I would expect that to do/return "Delete_Batch_Folders_Ex_S()" every time and neither Delete_Dim_Members_Ex_S() nor  Direct_WF_Cube_Ex_S() would ever be reached.

Every time your logic gets here it will get to "Return New Delete_Batch_Folders_Ex_S()" and then no further lines in this class will be processed as execution is returned to whatever called the step service.

I actually think your core problem is a bit of a lack of understanding of how the language works rather than the service factory complexity (although service factories doesn't help.. sounds like you jumped in the deep end!). You really need some conditional logic here to determine which of these 3 things to execute and when. This would reside in your DMSS class and I would guess the (if or select) condition would be based on something like args.Step.Name (i just made args.Step.Name up). This is the same as you would find in any factory or non factory XFBR or dashboard extender business rule.

Hope that helps. I don't have OneStream in front of me to give more detail and I hope I'm not completely off track!

 

HenningOneStream EmployeeAnswer
OneStream Employee
April 3, 2025

In addition to Daniel's response, I think it is good practice to use the service factory only as the initial router to point to a single service (file). In that service file I would apply the conditional logic.

In the below example, I call only Data Set and Component Service files from the SF and then apply all the conditional logic in those two files. The actual different data set and component code is then in files in my HelperFiles folder.

 

KH1
KH1Author
Contributor
April 2, 2025

TY - Daniel.

KH1
KH1Author
Contributor
April 3, 2025

I was wrong about my findings on SF/DMSS.
- Due to my lack of understanding of how 'Return' works.
- Daniel Willis - "I would expect that to do/return "Delete_Batch_Folders_Ex_S()" every time and neither Delete_Dim_Members_Ex_S() nor Direct_WF_Cube_Ex_S() would ever be reached."

Pls share how you'd write a conditional logic 
- Run a specific DM Job using SF/DMSS
- None of the DMSS is related to one another
1. Delete_Batch_Folders_Ex_S()
2. Delete_Dim_Members_Ex_S()
3. Direct_WF_Cube_Ex_S()

TY - Daniel and Henning and other SMEs who also want to help.

Legend
April 6, 2025

KH1  I would use parameters to signal decision logic which object to invoke via the service factory.  If you delegate this to yet another object, you've made an already complicated solution to a simple requirement even more complicated by using one factory pattern to to call another factory pattern to then call the actual business logic.

That said, I'm still figuring out how to or if I should make use of the 'itemName' parameter in the CreateWsAssemblyServiceInstance method signature.

Note: "parameter" here refers to the arguments in a method signature, not workspace parameters.
e.g. 'nameList' in: public function GetIds(nameList as List(Of String)) as String

I'm in a similar boat trying to figure out how to use an assembly to run logic for a DataManagement Step.  

Legend
April 6, 2025

.

KH1
KH1Author
Contributor
April 8, 2025

TY - DanielWillis / RobbSalzmann / Henning.
We will try to code our DMSS Decision Logic based on your advice.