hi ivyteam

I have a project with structure like this: alt text

There is three projects:

  • Project B is core project, it provide IService interface which is implemented by other sub Project, It also content a Map to store/cache instance of real service
  • Project B': Implement interface from B with real implementation (Class MyService), it use ivy cms to look up some cms which are only available on project B'.
  • Project A depend on Project B and consume interface IService (execute real implementation from B'). In order to register real implementation for that interface, in Project B' we have the EventStartBean will be run once when engine started, it will create instance of MyService and put to ServiceHolders map (a kind of service locator).

With this structure, we can abstract the implementation of project A and B, it don't care what is real implementation, just work with interface and can be reusable for many customer (each customer will have something similar with B' )

But one of the problem here is we execute the service from context of project A, it lead to issue that the api Ivy.cms().co(< uri of B' >) will return empty value. Go deeper into that api i see it will lookup cms from project where request has been started (project A), Another way that is triggering callable sub process from B' but i don't like that much.

My question is: Can we evaluate cms from project B' when A can't see B' ? If not, is there any suggestions?

asked 03.05 at 07:17

trungdv's gravatar image

trungdv
300234759
accept rate: 52%

edited 03.05 at 07:22


Hi @trungdv

You may want to try the solution proposed in Axon.ivy Discourse - Is there a way to obtain all CMS instances of all deployed modules?.

The basic idea in the answer is we try to reach all CMS instances of all deployed and released IProcessModelVersion of an IApplication (you need SYSTEM permissions to do that). When you can get all CMS instances, start looking up the URI, once the search hit a available result, you will get your IContentObject.

Hope it may help you resolve your problem.

link

answered 10.05 at 06:09

Genzer%20Hawker's gravatar image

Genzer Hawker
411182331
accept rate: 85%

edited 10.05 at 06:11

Thanks @Genzer Hawker :)

(12.05 at 04:24) trungdv trungdv's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×21

Asked: 03.05 at 07:17

Seen: 163 times

Last updated: 12.05 at 04:24