How do you configure WorkManagers in WebLogic 10.3? - concurrency

I would like to use a WorkManager to schedule some parallel jobs on a WebLogic 10.3 app server.
http://java.sun.com/javaee/5/docs/api/javax/resource/spi/work/WorkManager.html
I'm finding the Oracle/BEA documentation a bit fragmented and hard to follow and it does not have good examples for using WorkManagers from EJB 3.0.
Specifically, I'd like to know:
1) What exactly, if anything, do I need to put in my deployment descriptors (ejb-jar.xml and friends)?
2) I'd like to use the #Resource annotation to inject the WorkManager into my EJB 3 session bean. What "name" do I use for the resource?
3) How do I configure the number of threads and other parameters for the WorkManager.
My understanding is that the underlying implementation on WebLogic is CommonJ, but I'd prefer to use a non-proprietary approach if possible.

First, you'll find the documentation of CommonJ, an implementation of the Timer and Work Manager API developed by BEA Oracle and IBM, in Timer and Work Manager API (CommonJ) Programmer’s Guide. They provide a Work Manager Example but it's not injected in this document.
1) What exactly, if anything, do I need to put in my deployment descriptors (ejb-jar.xml and friends)?
According to the Work Manager Deployment section:
Work Managers are defined at the
server level via a resource-ref in the
appropriate deployment descriptor.
This can be web.xml or ejb-jar.xml
among others.
The following deployment descriptor
fragment demonstrates how to configure
a WorkManager:
...
<resource-ref>
<res-ref-name>wm/MyWorkManager</res-ref-name>
<res-type>commonj.work.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
...
Note: The recommended prefix for the JNDI namespace for WorkManager
objects is java:comp/env/wm.
Check the WorkManager javadocs for more details (e.g. "The res-auth and res-sharing scopes are ignored in this version of the specification. The EJB or servlet can then use the WorkManager as it needs to.").
2) I'd like to use the #Resource annotation to inject the WorkManager into my EJB 3 session bean. What "name" do I use for the resource?
I'd say something like this (not tested):
#ResourceRef(jndiName="java:comp/env/wm/MyWorkManager",
auth=ResourceRef.Auth.CONTAINER,
type="commonj.work.WorkManager",
name="MyWorkManager")
3) How do I configure the number of threads and other parameters for the WorkManager.
See the description of the <work-manager> element and Using Work Managers to Optimize Scheduled Work for detailed information on Work Managers
My understanding is that the underlying implementation on WebLogic is CommonJ, but I'd prefer to use a non-proprietary approach if possible.
I don't have any other suggestion (and, as long as this implementation follows the standards, I wouldn't mind using it).

The Weblogic documentation will answer your questions.
Using Work Managers to Optimize Scheduled Work

Related

Does anyone know how to retrieve the list of tasks in Camunda 8, without using tasklist?

I am currently evalauting Camunda, having previously used version 7 in the past which seems to be significantly more open source than version 8.
I am aware that tasklist and an official tasklist-api exist, however they are only permitted during development and testing without a license.
In Bernd Rücker's medium post How Open is Camunda Platform 8?, there is a section:
A path to production with source-available software
...
Additionally, you will need to find solutions to replace the tools you cannot use.
Tasklist
You will need to implement your own task management solution based on using workers subscribing to Zeebe as described in the docs. That also means you have to build your own persistence to allow task queries, as the Tasklist API is part of the Tasklist component and is not free for production use.
I have tried to search the zeebe source for any hints, but the only job/task related APIs I seem to be able to find are:
activateJobs
completeJob
I do not believe that these could be the endpoints that tasklist uses as the jobs have to be manually claimed by user interaction from the UI.
Does anyone know how this is achieved?
Your own zeebe exporter allows you to export any events the engine produces, such as user task state updates. You could store this information in a data sink of your choice and and implement an API on top of it.
See, e.g. https://camunda.com/blog/2019/05/exporter-part-1/

Spring Cloud Function - Manual Bean Registration and Loading Configuration Classes

I am currently using Spring Cloud function 3.07.RELEASE with the AWS Adapter for lambda.
We are using a limited scope Functional Bean registration and understand that this does not include full Spring Boot autoconfiguration. We are okay with this as we value the speed and significant reduction cold start times.
However, we do have configuration classes that we want to utilize and assume that this needs to be done manually. What is the best practice on importing these classes?
We tried searching, but failed to find documentation on the differences in behavior of the limited scope context vs spring boot application context.
If I understand your question correctly all you need to do is register those configuration classes manually and the rest will be autowired. There was a little issue with it which may or may not affect you. In any event it was fixed and will be available in 3.0.9 release next week.

Dynamic database connection in Symfony 4

I am setting up a multi tenant Symfony 4 application where each tenant has it's own database.
I've set up two database connections in the doctrine.yaml config. One of the connections is static based on an env variable. The other one should have a dynamic URL based on a credential provider service.
doctrine:
dbal:
connections:
default:
url: "#=service('provider.db.credentials').getUrl()"
The above expression "#=service('provider.db.credentials').getUrl()" is not being parsed though.
When injecting "#=service('provider.db.credentials').getUrl()" as argument into another service the result of getUrl() on the provider.db.credentials service is injected. But when using it in the connection configuration for doctrine the expression is not being parsed.
Does anyone have an idea how to solve this?
You're trying to rely on ability of Symfony services definition to use expressions for defining certain aspects of services. However you need to remember that this functionality is part of Dependency Injection component which is able (but not limited to) to use configuration files for services. To be more precise - this functionality is provided by configuration loaders, you can take a look here for example of how it is handled by Yaml configuration loader.
On the other hand configuration for Doctrine bundle, you're trying to use is provided by Config component. A fact that Dependency Injection component uses same file formats as Config component do may cause an impression that these cases are handled in the same way, but actually they're completely different.
To sum it up: expression inside Doctrine configuration does not work as you expecting because Doctrine bundle configuration processor doesn't expect to get an Expression Language expression and doesn't have support for handling them.
While explanations given above are, hopefully, answers your question - you're probably expecting to get some information about how to actually solve your problem.
There is at least 2 possible ways to do it, but choosing correct way may require some additional information which is out of scope of this question.
In a case if you know which connection to choose at a time of container building (your code assumes that it is a case, but you may not be aware about it) - then you should use compiler pass mechanism yo update Doctrine DBAL services definitions (which may be quite tricky). Reason for this non-trivial process is that configurations are loaded at the early stages of container building process and provides no extension points. You can take a look into sources if necessary. Anyway, while possible, I would not recommend you to go in this way and most likely you will not need it because (I suppose) you need to select connection in runtime rather then in container building time.
Probably more correct approach is to create own wrapper of DBAL Connection class that will maintain list of actual connections and will provide required connection depending on your application's logic. You can refer to implementation details of DBAL sharding feature as example. Wrapper class can be defined directly through Doctrine bundle configuration by using wrapper_class key for dbal configuration

WebService Task in Camunda

In Camunda BPM designer, I couldn't find activity and for invoking a REST or SOAP based webservices. Is it only possible to invoke through wiring code? How do I pass payload to the code if it needs to be written using java code.
Regards,
Phani
You can invoke a Webservice inside a bpmn.
You can create a Task of type Service, and choose in Properties/Details/Implementation: Connector.
Next you configure Connector properties, setting:
Connector Id: http-connector (for rest json webservices) and
Input Parameters:
url (e.g. http://localhost:8080/client?id=12
method GET/POST
headers type MAP: Accept application/json...
You receive the webservice response as Process Variables, configuring the Output parameters as follows :
response, type text, value ${response}
returnCode, type text, value ${statusCode}
Hope this helps you
For start: please note that camundas claim is "developer friendly". It's never been the goal of camunda components to just "click together" a working process. If you are looking for such a solution, you should a) have a look at the zero coding myth and b) maybe choose another tool.
That being said, check out the camunda-connect framework, introduced with 7.2, it should do what you need (though it involves xml coding).
For all but the most simple SOAP / REST calls, you'll need to go through java code. This takes a little getting used to when moving from other BPM platforms with extensive built-in webservice support. But trust me, java code is the way to go - import of transform / WSDL in the process definiton becomes such a holy mess.
I've written two CXF-based examples: soap-cxf-service and soap-cxf-server-start which will get you started.
I recommend creating a maven artifact per webservice and just adding the required services as standard maven dependencies for your process project.

What GUI tool can I use for building applications that interact with multiple APIs?

My company uses a lot of different web services on daily bases. I find that I repeat same steps over and over again on daily bases.
For example, when I start a new project, I perform the following actions:
Create a new client & project in Liquid Planner.
Create a new client Freshbooks
Create a project in Github or Codebasehq
Developers to Codebasehq or Github who are going to be working on this project
Create tasks in Ticketing system on Codebasehq and tasks in Liquid Planner
This is just when starting new projects. When I have to track tasks, it gets even trickier because I have to monitor tasks in 2 different systems.
So my question is, is there a tool that I can use to create a web service that will automate some of these interactions? Ideally, it would be something that would allow me to graphically work with the web service API and produce an executable that I can run on a server.
I don't want to build it from scratch. I know, I can do it with Python or RoR, but I don't want to get that low level.
I would like to add my sources and pass data around from one service to another. What could I use? Any suggestions?
Progress DataXtend Semantic Integrator lets you build WebServices through an Eclipse based GUI.
It is a commercial product, and I happen to work for the company that makes it. In some respects I think it might be overkill for you, as it's really an enterprise-level data mapping tool for mapping disparate data sources (web services, databases, xml files, COBOL) to a common model, as opposed to a simple web services builder, and it doesn't really support your github bits, anymore than normal Eclipse plugins would.
That said, I do believe there are Mantis plugins for github to do task tracking, and I know there's a git plugin for Eclipse that works really well (jgit).
Couldn't you simply use Selenium to execute some of this tasks for you? Basically as long as you can do something from the browser, Selenium will also be able to do. Selenium comes with a language called "selenese", so you can even use it to programmatically create an "API" with your tasks.
I know this is a different approach to what you're originally looking for, but I've been using selenium for a number of tasks, and found it's even good to execute ANT tasks or unit tests.
Hope this helps you
What about Apache Camel?
Camel lets you create the Enterprise Integration Patterns to implement routing and mediation rules in either a Java based Domain Specific Language (or Fluent API), via Spring based Xml Configuration files or via the Scala DSL. This means you get smart completion of routing rules in your IDE whether in your Java, Scala or XML editor.
Apache Camel uses URIs so that it can easily work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF Bus API together with working with pluggable Data Format options.