Hello Rajesh,

Did you try the README.md? It should be pretty comprehensive. Also,
try to understand the overall design. Ignore for a second the syntax
and think of the design of multi tenancy. You have the following
databases:

1- The OFBiz standard single tenant instance (ofbiz)
2- A master database for all tenants (ofbizTenant)
3- A database per tenant.

When you call the command createTenant, you essentially load that
tenant's information into the tenants master database AND you also
create a new database specific to that tenant.

The main differentiation between the tenants is the delegator name.
The default database has the delegator "delegator". Every tenant has a
database with a delegator called "delegator#TenantIdHere"

So, when loading specific data like seed, for a specific tenant, then
you need to pass both the readers AND the correct delegator.

I hope this helps and that I understood and answered your question
appropriately.

On Sat, Mar 10, 2018 at 9:29 PM, Rajesh Mallah <mallah.raj...@gmail.com> wrote:
> Hi ,
>
> I am trying to setup/configure ofbiz with multi tenant feature
> i am following the doc
>
> https://cwiki.apache.org/confluence/display/OFBIZ/Multitenancy+support
>
> there are 2 gradle tasks related to tenants
>
> createTenant - Create a new tenant in your environment
> loadTenant - Load data using tenantId
>
> however they are not referenced in that doc . More over the
> docs refer to ant and the commands eg:
>
>
> java -Xmx512m -XX:MaxPermSize=128m -jar ./build/libs/ofbiz.jar -install
> -readers=seed,seed-initial,ext -delegator=default
> does not really work.
>
>
> could someone please point to some references that would help.
>
> particularly i have done till below
>
>
>    - OFBIZ-HOME/framework/entity/data/<yourTenantConfig>.xml
>    - OFBIZ-HOME/framework/entity/config/entityengine.xml
>    - OFBIZ-HOME/framework/entity/ofbiz-component.xml
>
> and i ran
>  ./gradlew "ofbiz --load-data readers=seed,seed-initial,ext "
>
> in ofbiz-component i have :
>
>     <entity-resource type="data"  reader-name="ext" loader="main"
> location="data/TenantDemoData.xml"/>
>
> TenantDemoData.xml
> =================
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <entity-engine-xml>
> <Tenant tenantId="TENANT-A" tenantName="Tenant A"/>
> <TenantDataSource tenantId="TENANT-A" entityGroupName="org.apache.ofbiz"
> jdbcUri="jdbc:postgresql://postgresql/tenant_a_db"
> jdbcUsername="ofbiz_cust_a" jdbcPassword="xxxxxxxxxxxx"/>
> <TenantDataSource tenantId="TENANT-A"
> entityGroupName="org.apache.ofbiz.olap"
> jdbcUri="jdbc:postgresql://postgresql/tenant_a_db"
> jdbcUsername="ofbiz_cust_a" jdbcPassword="xxxxxxxxxxxx"/>
> </entity-engine-xml>
>
> ===========================
>
> entityengine.xml
> =============================
>
>   <delegator name="default" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> distributed-cache-clear-enabled="false">
>         <group-map group-name="org.apache.ofbiz"
> datasource-name="localpostgres"/>
>         <group-map group-name="org.apache.ofbiz.olap"
> datasource-name="localpostolap"/>
>         <group-map group-name="org.apache.ofbiz.tenant"
> datasource-name="localposttenant"/>
>     </delegator>
>     <delegator name="default-no-eca" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main"
> entity-eca-enabled="false" distributed-cache-clear-enabled="false">
>         <group-map group-name="org.apache.ofbiz"
> datasource-name="localpostgres"/>
>         <group-map group-name="org.apache.ofbiz.olap"
> datasource-name="localpostolap"/>
>         <group-map group-name="org.apache.ofbiz.tenant"
> datasource-name="localposttenant"/>
>     </delegator>
>
>     <!-- be sure that your default delegator (or the one you use) uses the
> same datasource for test. You must run "gradlew loadDefault" before running
> "gradlew testIntegration" -->
>     <delegator name="test" entity-model-reader="main"
> entity-group-reader="main" entity-eca-reader="main">
>         <group-map group-name="org.apache.ofbiz"
> datasource-name="localpostgres"/>
>         <group-map group-name="org.apache.ofbiz.olap"
> datasource-name="localpostolap"/>
>         <group-map group-name="org.apache.ofbiz.tenant"
> datasource-name="localposttenant"/>
>     </delegator>
> ========================================================
>
>
> what is next?
>
>
>
>
> regds
> rajesh kr mallah.

Reply via email to