Working With MsgProcessingContext
When platform dequeue the message, by default it uses the ValueChainAdmin context to process the message which won't work when uploading data using EPT interfaces as ValueChain level user will not have access to EPT interfaces.
For this, you can load MsgProcessingContext in your system
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
standalone
=
"yes"
?>
<
ModelList
xmlns
=
"http://www.onenetwork.com/Platform"
>
<
ValueChainId
>9123</
ValueChainId
>
<
CustomModelName
>Standard MsgProcessingContext</
CustomModelName
>
<
ActionName
>PLT.InsertOrUpdate</
ActionName
>
<
MsgProcessingContext
>
<
ValueChainId
>9123</
ValueChainId
>
<
OwningQueueName
>inbox/Bookstore</
OwningQueueName
>
<
InboundInterfaceName
>EPT.SampleEnterprise.UploadBook</
InboundInterfaceName
>
<
InboundInterfaceVersion
>1.0</
InboundInterfaceVersion
>
<
Sender
>9123.
http://localhost/oms
</
Sender
>
<
ResolverClass
>com.mybook.BookContextResolver</
ResolverClass
>
<
ProcessingContextRoleEnterpriseName
>SampleEnterprise</
ProcessingContextRoleEnterpriseName
>
<
ProcessingContextRoleOrganizationName
>SampleOrg</
ProcessingContextRoleOrganizationName
>
<
ProcessingContextRoleName
>SampleRole</
ProcessingContextRoleName
>
<
ProcessingContextUserValueChainId
>9123</
ProcessingContextUserValueChainId
>
<
ProcessingContextUserEnterpriseName
>SampleEnterprise</
ProcessingContextUserEnterpriseName
>
<
ProcessingContextUserName
>BookstoreUser</
ProcessingContextUserName
>
<
ProcessingContextRoleValueChainId
>9123</
ProcessingContextRoleValueChainId
>
</
MsgProcessingContext
>
</
ModelList
>
After dequeuing the messages, platform search for all MsgProcessingContext which matches with the Message OwningQueue.
Platform iterate all the entries and for each MsgProcessingContext, if ResolverClass (extending com.onenetwork.platform.integ.msg.ContextResolver) is defined on MsgProcessingContext and returns the non-null user context, will use that to process the message.
If none of the entries returns a non-null user context, platform will iterate the entries again and find the record with the highest number of matching fields between the Message and MessageProcessingContext for fields other than ResolverClass and if user context is non-null on that entry, will use that to process the message.
if non of the entries returns a non-null user context using the above, default ValueChainAdmin context will be used to process the message.