Re: [basex-talk] Embedded BaseX
Hi Carl, Sorry I forgot to answer, it's always nice to see more opinions and ideas. We already have a system working on a monolithic application deployed in an application server, but I was creating a new context each time just to be sure, and now that I'm moving this on a separate service It was the perfect time to investigate how to make it better :) I've also worked with the client / server approach and the dockerized version of BaseX, and while both are easy to work with, they don't cover all our needs. I'm hoping to implement an error resilient messaging queue or use reactive streams and make sure network issues won't affect the XQuery scripts execution. George On 07/11/2017 03:11 PM, Bondeson, Carl wrote: I am using BaseX in a multithreaded environment, which is highly transactional. I ended up using a singleton class as the controller and all other threads execute queries against this singleton class. I have successfully implemented an ELR (Electronic Laboratory Reporting) messaging system which is in production. This system runs under JBoss so you should not have any issues using something like Wildfly as an application server. Carl R Bondeson IT Analyst 3 Information Technology Connecticut Department of Public Health 410 Capitol Ave Hartford, CT 06134 Phone: 860-509-7434 carl.bonde...@ct.gov -Original Message- From: basex-talk-boun...@mailman.uni-konstanz.de [mailto:basex-talk-boun...@mailman.uni-konstanz.de] On Behalf Of Christian Grün Sent: Tuesday, July 11, 2017 8:02 AM To: George Sofianos Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Embedded BaseX Hi George, It’s recommendable indeed to only create one instance of the Context class. Context instances are lightweight, but operations like transactions are centrally controlled by this class. QueryProcessor are usually created anew for each query evaluation. Number of jobs… Just start in the Context class and follow the JobPool reference. Via the PARALLEL option [1], you can set a maximum limit of parallel database transactions. If you want to enforce that there are never more than transactions running, you can set FAIRLOCK [2] to true. I’ve just updated the description of the PARALLEL option to indicate what has changed since the introduction of the FAIRLOCK option. Hope this helps, Christian [1] http://docs.basex.org/wiki/Options#PARALLEL [2] http://docs.basex.org/wiki/Options#FAIRLOCK On Tue, Jul 11, 2017 at 11:36 AM, George Sofianos wrote: Hello, I'm building a web service that along with some other things (XML Validation, Saxon XQuery, etc) includes a BaseX processor for running XQuery scripts. I'm wondering what is the best way to use an embedded BaseX processor. Can some objects be shared (e.g Context, QueryProcessor), or are they very lightweight and there is no need to share / reuse ? Can I get the number of the jobs running and the job status like in the client / server mode? My intention is to make sure I can limit the amount of the jobs running in parallel, and have more control over the execution (maybe cancel jobs if necessary) Thanks, George
Re: [basex-talk] Embedded BaseX
I am using BaseX in a multithreaded environment, which is highly transactional. I ended up using a singleton class as the controller and all other threads execute queries against this singleton class. I have successfully implemented an ELR (Electronic Laboratory Reporting) messaging system which is in production. This system runs under JBoss so you should not have any issues using something like Wildfly as an application server. Carl R Bondeson IT Analyst 3 Information Technology Connecticut Department of Public Health 410 Capitol Ave Hartford, CT 06134 Phone: 860-509-7434 carl.bonde...@ct.gov -Original Message- From: basex-talk-boun...@mailman.uni-konstanz.de [mailto:basex-talk-boun...@mailman.uni-konstanz.de] On Behalf Of Christian Grün Sent: Tuesday, July 11, 2017 8:02 AM To: George Sofianos Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Embedded BaseX Hi George, It’s recommendable indeed to only create one instance of the Context class. Context instances are lightweight, but operations like transactions are centrally controlled by this class. QueryProcessor are usually created anew for each query evaluation. Number of jobs… Just start in the Context class and follow the JobPool reference. Via the PARALLEL option [1], you can set a maximum limit of parallel database transactions. If you want to enforce that there are never more than transactions running, you can set FAIRLOCK [2] to true. I’ve just updated the description of the PARALLEL option to indicate what has changed since the introduction of the FAIRLOCK option. Hope this helps, Christian [1] http://docs.basex.org/wiki/Options#PARALLEL [2] http://docs.basex.org/wiki/Options#FAIRLOCK On Tue, Jul 11, 2017 at 11:36 AM, George Sofianos wrote: > Hello, > > I'm building a web service that along with some other things (XML > Validation, Saxon XQuery, etc) includes a BaseX processor for running > XQuery scripts. I'm wondering what is the best way to use an embedded > BaseX processor. Can some objects be shared (e.g Context, > QueryProcessor), or are they very lightweight and there is no need to share / > reuse ? > Can I get the number of the jobs running and the job status like in > the client / server mode? My intention is to make sure I can limit the > amount of the jobs running in parallel, and have more control over the > execution (maybe cancel jobs if necessary) > > Thanks, > > George >
Re: [basex-talk] Embedded BaseX
This is exactly what I was looking for, thanks! George On 07/11/2017 03:02 PM, Christian Grün wrote: Hi George, It’s recommendable indeed to only create one instance of the Context class. Context instances are lightweight, but operations like transactions are centrally controlled by this class. QueryProcessor are usually created anew for each query evaluation. Number of jobs… Just start in the Context class and follow the JobPool reference. Via the PARALLEL option [1], you can set a maximum limit of parallel database transactions. If you want to enforce that there are never more than transactions running, you can set FAIRLOCK [2] to true. I’ve just updated the description of the PARALLEL option to indicate what has changed since the introduction of the FAIRLOCK option. Hope this helps, Christian [1] http://docs.basex.org/wiki/Options#PARALLEL [2] http://docs.basex.org/wiki/Options#FAIRLOCK On Tue, Jul 11, 2017 at 11:36 AM, George Sofianos wrote: Hello, I'm building a web service that along with some other things (XML Validation, Saxon XQuery, etc) includes a BaseX processor for running XQuery scripts. I'm wondering what is the best way to use an embedded BaseX processor. Can some objects be shared (e.g Context, QueryProcessor), or are they very lightweight and there is no need to share / reuse ? Can I get the number of the jobs running and the job status like in the client / server mode? My intention is to make sure I can limit the amount of the jobs running in parallel, and have more control over the execution (maybe cancel jobs if necessary) Thanks, George
Re: [basex-talk] Embedded BaseX
Hi George, It’s recommendable indeed to only create one instance of the Context class. Context instances are lightweight, but operations like transactions are centrally controlled by this class. QueryProcessor are usually created anew for each query evaluation. Number of jobs… Just start in the Context class and follow the JobPool reference. Via the PARALLEL option [1], you can set a maximum limit of parallel database transactions. If you want to enforce that there are never more than transactions running, you can set FAIRLOCK [2] to true. I’ve just updated the description of the PARALLEL option to indicate what has changed since the introduction of the FAIRLOCK option. Hope this helps, Christian [1] http://docs.basex.org/wiki/Options#PARALLEL [2] http://docs.basex.org/wiki/Options#FAIRLOCK On Tue, Jul 11, 2017 at 11:36 AM, George Sofianos wrote: > Hello, > > I'm building a web service that along with some other things (XML > Validation, Saxon XQuery, etc) includes a BaseX processor for running XQuery > scripts. I'm wondering what is the best way to use an embedded BaseX > processor. Can some objects be shared (e.g Context, QueryProcessor), or are > they very lightweight and there is no need to share / reuse ? > Can I get the number of the jobs running and the job status like in the > client / server mode? My intention is to make sure I can limit the amount of > the jobs running in parallel, and have more control over the execution > (maybe cancel jobs if necessary) > > Thanks, > > George >
[basex-talk] Embedded BaseX
Hello, I'm building a web service that along with some other things (XML Validation, Saxon XQuery, etc) includes a BaseX processor for running XQuery scripts. I'm wondering what is the best way to use an embedded BaseX processor. Can some objects be shared (e.g Context, QueryProcessor), or are they very lightweight and there is no need to share / reuse ? Can I get the number of the jobs running and the job status like in the client / server mode? My intention is to make sure I can limit the amount of the jobs running in parallel, and have more control over the execution (maybe cancel jobs if necessary) Thanks, George