Questions Tagged With repositoryhttps://answers.axonivy.com/tags/repository/?type=rssquestions tagged <span class="tag">repository</span>enTue, 24 Sep 2019 02:58:44 -0400How to persist fields in ivy repo but not index in elastic?https://answers.axonivy.com/questions/4010/how-to-persist-fields-in-ivy-repo-but-not-index-in-elastic<p>For some projects it is interesting to store all data including files to the database so we can run such instances in docker and share the database. This way it would be possible to store the data in the business repo, even as we seen in <a href="https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob">https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob</a> it is not always efficient. But we would not need to index the base64 conent of the file in elastic. Is it possible?</p>adamfTue, 24 Sep 2019 02:58:44 -0400https://answers.axonivy.com/questions/4010/how-to-persist-fields-in-ivy-repo-but-not-index-in-elasticfilebusiness-dataelasticsearchpersistencerepositoryThere is a 1-second latency between ivy.repo.save(object) and ivy.repo.search(Object.class)https://answers.axonivy.com/questions/3681/there-is-a-1-second-latency-between-ivy-repo-save-object-and-ivy-repo-search-object-class<p>Hi Axon.ivy Team,</p> <p>Given the snippet of code:</p> <pre><code>Person p = new Person(); p.id = UUID.randomUUID().toString(); p.name = "John Doe"; p.birthdate = LocalDate.now(); ivy.repo.save(p); Object result = ivy.repo.search(Person.class) .textField("id").containsPhrase(p.id) .execute().getFirst(); ivy.log.error("HHH - it is null " + #result); Thread.sleep(TimeUnit.SECONDS.toMillis(1)); result = ivy.repo.search(Person.class) .textField("id").containsPhrase(p.id) .execute().getFirst(); ivy.log.error("HHH - it is null " + #result); </code></pre> <p>I found that there was a <em>1-second</em> latency between the call to <code>ivy.repo.save()</code> and <code>ivy.repo.search()</code>. This is super annoying because we had to wait for <em>1-second</em> every time until the saved object can be searched via the API. Blocking the execution for 1-second to wait until it is indexed to ES <em>every</em> <em>time</em> we save the object into the <code>BusinessDataRepository</code> is a terrible hack.</p> <p>Is it by design? Can this be fixed so that the two calls work?</p> <blockquote> <p>P.S: Please don't advise me to use the returned BusinessData id because it doesn't address my issue. I want to <em>search</em> back the data I save based on the object's field, not fetching it again.</p> <p>P.P.S: Tested with Axon.ivy Designer 7.2.1 on my local workstation.</p> </blockquote> <p><strong>UPDATE</strong></p> <p><em>25.2.2019</em>:</p> <p>In our project, we were able to develop RESTful API for other parties. As we already have persisted our objects (for example <code>Dossier</code>), in <code>BusinessDataRespository</code>, we would want to preserve that behavior.</p> <p>An excerpt from of our OpenAPI spec:</p> <pre><code>paths: /dossiers/{dossier_id}/persons/: post: operationId: addPersonToDossier description: add a single person into an existing Dossier requestbody: 'application/json': schema: $ref: '#/components/schemas/Person' responses: '201': get: operationId: getAllPersonsInDossier description: get *all* existing persons of an existing Dossier responses: '200': content: 'application/json': schema: type: array items: $ref: '#/components/schemas/Person' </code></pre> <p>From our client, after they have already invoked several calls to <code>addPersonToDossier</code>, they may want to invoke <code>getAllPersonsInDossier</code> to fetch all <code>Person</code>s of a <code>Dossier</code>. </p> <p>We persists <code>Person</code> separately from our <code>Dossier</code> to avoid <code>ConcurrentModificationException</code>, each <code>Person</code> holds a reference to its <code>Dossier</code>. Now in order to implement <code>getAllPersonsInDossier</code>, we have to use <code>Ivy.repo().search(..)</code>.</p> <p>Unfortunately, due to the 1-second latency, calling <code>getAllPersonsInDossier</code> too soon will probably return an empty result. This forces us to either:</p> <ul> <li>Require our clients to WAIT on their side for <em>1-second</em> until they can call <code>getAllPersonsInDossier</code>.</li> <li>On the server side, we somehow have to implement a <code>while</code> loop to check until the <code>Person</code> could be found via search API, then we consider the <code>addPersonToDossier</code> finishes (or worse, a <code>Thread.sleep(1000)</code>).</li> </ul> <p>Jack</p>vagabondFri, 22 Feb 2019 01:16:25 -0500https://answers.axonivy.com/questions/3681/there-is-a-1-second-latency-between-ivy-repo-save-object-and-ivy-repo-search-object-classbusiness-dataelasticsearchrepositoryCan not connect to Elasticsearch serverhttps://answers.axonivy.com/questions/2831/can-not-connect-to-elasticsearch-server<p>hi all</p> <p>I'm using Axon ivy 6.3 on Linux server. Sometime i get this exception (after deployment somehow):</p> <pre><code> Caused by: ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.ElasticsearchException: Cannot reach Elasticsearch server at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestOperation.execute(JestOperation.java:44) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestSearcher.search(JestSearcher.java:32) at ch.ivyteam.ivy.business.data.store.search.internal.ResultImpl.execute(ResultImpl.java:36) at ch.ivyteam.ivy.business.data.store.search.internal.QueryImpl.raw(QueryImpl.java:135) at ch.ivyteam.ivy.business.data.store.search.internal.QueryImpl.executeQuery(QueryImpl.java:179) at ch.ivyteam.ivy.business.data.store.search.internal.ExecutorImpl.execute(ExecutorImpl.java:18) at ch.ivyteam.ivy.business.data.store.search.internal.QueryImpl.execute(QueryImpl.java:115) at ch.axonivy.fintech.standard.dossier.DossierIdGenerator.initializeSeed(DossierIdGenerator.java:64) at ch.axonivy.fintech.standard.dossier.DossierIdGenerator.nextId(DossierIdGenerator.java:43) at ch.axonivy.fintech.abs.dossier.AbsDossierService.generateCobId(AbsDossierService.java:57) at sun.reflect.GeneratedMethodAccessor9141.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73) ... 211 more Caused by: io.searchbox.client.config.exception.CouldNotConnectException: Could not connect to <a href="http://localhost:19200">http://localhost:19200</a> at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:59) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestOperation.execute(JestOperation.java:37) ... 224 more Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19200 [localhost/127.0.0.1] failed: Connection refused at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107) at io.searchbox.client.http.JestHttpClient.executeRequest(JestHttpClient.java:109) at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:56) ... 225 more Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141) ... 236 more </code></pre> <p>After restarting server, it's seem to work again.</p> <p>The exception is clear but we don't know rootcause yet. Does anyone get same issue? and do you have any hints for it?</p> <p>Updated: i have deployed several ivy engine on same physical server, i think there is some instance of elasticservers as well. Could it be a confliction there?</p> <p>Thanks in advance</p>trungdvTue, 29 Aug 2017 03:47:58 -0400https://answers.axonivy.com/questions/2831/can-not-connect-to-elasticsearch-serveraxonivy6.3elasticsearchrepositoryCan we persist Elastic Search data to Business Data table?https://answers.axonivy.com/questions/2799/can-we-persist-elastic-search-data-to-business-data-table<p>hi ivyteam</p> <p>As far as i know, when we use ivy.repo() from ivy, data will be stored to table IWA.BusinessData and indexed to Elastic Search cluster. Normally ivy will create that index from that table when it start by this command: <code>DiCore.getGlobalInjector().getInstance(ElasticSearchServerManager.class).startIndexRecreation();</code></p> <p>In my case, i want to do it in opposite way that collecting data from index table then persist to IWA.BusinessData, just imagine that table has lost data for some reasons so i want to recover it. Can i do it in ivy?</p> <p>Thanks</p>trungdvTue, 08 Aug 2017 06:58:47 -0400https://answers.axonivy.com/questions/2799/can-we-persist-elastic-search-data-to-business-data-tablebusiness-datarepositoryCan not use ivy.repo in ResfulAPIhttps://answers.axonivy.com/questions/2777/can-not-use-ivy-repo-in-resfulapi<p>hi all</p> <p>I'm now using Ivy 6.3. When i create ResfulAPI by java (not use ivy element) and in that api i try to use ivy.repo() to store some data, it throw two exception: <img alt="alt text" src="http://answers.axonivy.com/upfiles/img1.png"> and <img alt="alt text" src="http://answers.axonivy.com/upfiles/img2.png"> I guess that because with pure java api, there is no task and case created but why we need them? as my understanding ivy.repo will store data to Ivy System DB and it's different from ivy process data which highly-related to ivy task&amp;case.</p> <p>Anybody can explain ? Thanks a lot</p>trungdvTue, 25 Jul 2017 06:16:41 -0400https://answers.axonivy.com/questions/2777/can-not-use-ivy-repo-in-resfulapicasebusiness-datarepositoryHow to upgrade elasticsearch engine on designer?https://answers.axonivy.com/questions/2713/how-to-upgrade-elasticsearch-engine-on-designer<p>Hi ivyteam</p> <p>Currently i use Axonivy 6.3 and it embed elasticsearch with version 2.3.4, it's quite old version so i want to upgrade to new version in order to apply new api or module being supported by elasticsearch (kibana/xpack,...) On server i can configure the setting in system property, but how can i do it on designer? </p> <p>Thanks</p>trungdvTue, 27 Jun 2017 05:19:14 -0400https://answers.axonivy.com/questions/2713/how-to-upgrade-elasticsearch-engine-on-designerelasticsearchrepositoryCan not persist Business Data to Repo after changing data typehttps://answers.axonivy.com/questions/2606/can-not-persist-business-data-to-repo-after-changing-data-type<p>Hi all</p> <p>I'm using Ivy 6.3 and use ivy.repo api to persist data. When i persits data as this JSON:</p> <pre><code>"qualificationMessageResults": [ { "code": "amount", "severity": "ORANGE", "message": { "descriptor": { "content": "/ch/axonivy/fintech/soba/Message/PreQualification/Amount/amountBetweenMinAmountAndMaxAmountForReplacement", "type": "URI" }, "paramDescriptors": [ { "descriptor": { "content": "500000", "type": "PLAIN_TEXT", "placeHolder": "{minAmount}" }, "paramDescriptors": [] } ] } } ] }, </code></pre> <p>The api say:</p> <pre><code> [errorId=15BCE2ED377AD1E0, request=HTTP POST ch/axonivy/fintech/soba/showcase/DemoSobaPersistence/DemoSobaPersistenceProcess.mod/15A1694DAA1C0A9F(9907.9907.17.0), session=1, task=9907, application=102, requestId=4093, executionContext=1, pmv=Portal$soba_test$2, hd=ch.axonivy.fintech.soba.showcase.DemoSobaPersistence, processElement=15A168DC648B6158-f9] Caused by: ch.ivyteam.ivy.persistence.PersistencyException: Could not create BusinessData. at ch.ivyteam.ivy.business.data.store.internal.ElasticSystemDbPersistence.execute(ElasticSystemDbPersistence.java:115) at ch.ivyteam.ivy.business.data.store.internal.ElasticSystemDbPersistence.execute(ElasticSystemDbPersistence.java:104) at ch.ivyteam.ivy.business.data.store.internal.ElasticSystemDbPersistence.create(ElasticSystemDbPersistence.java:89) at ch.ivyteam.ivy.business.data.store.internal.BusinessDataRepositoryImpl.persist(BusinessDataRepositoryImpl.java:112) at ch.ivyteam.ivy.business.data.store.internal.BusinessDataRepositoryImpl.save(BusinessDataRepositoryImpl.java:96) at ch.axonivy.fintech.standard.dossier.persistence.BaseDossierPersistence.persist(BaseDossierPersistence.java:35) at ch.axonivy.fintech.soba.dossier.service.SobaDossierService.persist(SobaDossierService.java:155) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73) ... 208 more [errorId=15BCE2ED377AD1E0, request=HTTP POST ch/axonivy/fintech/soba/showcase/DemoSobaPersistence/DemoSobaPersistenceProcess.mod/15A1694DAA1C0A9F(9907.9907.17.0), session=1, task=9907, application=102, requestId=4093, executionContext=1, pmv=Portal$soba_test$2, hd=ch.axonivy.fintech.soba.showcase.DemoSobaPersistence, processElement=15A168DC648B6158-f9] Caused by: ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.ElasticsearchException: Elasticsearch update index of document failed because of: {"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [onlineMortgageProgress.qualificationMessageResults.message]"}],"type":"mapper_parsing_exception","reason":"failed to parse [onlineMortgageProgress.qualificationMessageResults.message]","caused_by":{"type":"illegal_argument_exception","reason":"unknown property [descriptor]"}} at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestOperation.checkStatusAndThrow(JestOperation.java:61) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestOperation.execute(JestOperation.java:39) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestIndexSynchronizer.execute(JestIndexSynchronizer.java:165) at ch.ivyteam.ivy.business.data.store.search.internal.elasticsearch.JestIndexSynchronizer.updateIndex(JestIndexSynchronizer.java:64) at ch.ivyteam.ivy.business.data.store.search.internal.ElasticBusinessDataSearchIndex.update(ElasticBusinessDataSearchIndex.java:30) at ch.ivyteam.ivy.business.data.store.internal.ElasticSystemDbPersistence.lambda$1(ElasticSystemDbPersistence.java:96) at ch.ivyteam.ivy.persistence.base.AbstractPersistencyService.execute(AbstractPersistencyService.java:177) at ch.ivyteam.ivy.persistence.base.AbstractPersistencyService.execute(AbstractPersistencyService.java:240) at ch.ivyteam.ivy.persistence.base.ClassPersistencyService.execute(ClassPersistencyService.java:694) at </code></pre> <p>My object QualificationMessageResult has list of Object A, and object A has two properties: a object <strong>descriptor</strong> and a list of Object A (looped Object) with name: <strong>paramDescriptors</strong>. </p> <p>Can anyone suggest me something?</p> <p>Thanks</p>trungdvWed, 03 May 2017 09:41:52 -0400https://answers.axonivy.com/questions/2606/can-not-persist-business-data-to-repo-after-changing-data-typerepository