I want to use timerTrigger in azure functions.
I created function according this guide:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-maven-intellij
it is generated by default httpTrigger. I tried command of azure-functions:add.
I succeeded adding timerTrigger but I encountered with a lot of errors
How I can delete httpTrigger and declaring only timerTrigger?
before I run the azure-functions:add:
after running the command:
I guess it is related to azure plugin and maven plugin conflict but not sure and I don't know how to handle such this situation
any help will be appreciated
thanks
For now, I suppose it doesn't support create java function with default timer trigger. However you could delete the HTTP one then create the timer, cause you don't provide much information so maybe you could refer to my steps.
Create the function with maven.(I'm using the 1.22 version)
Delete the HTTP function, and delete the test folder.
Create the Timer Trigger function.
After this the project will be like this.(Before packaging remember set the storage connection string in the local.settings.json)
Package it.(Use the package method in the Lifecycle.)
Run it with azure-functions:run under azure-functions plugin.
Related
I have a problem with maven-dbunit-plugin.
The common use of maven-dbunit-plugin is running a command like mvn dbunit:operation in the shell.
But now, I have a spring batch job. The work of this job is writing data by sample-data.xml file to the database.
The command mvn dbunit:operation depends on the maven project with the pom.xml. This is not the style what I want.
How to write code using maven-dbunit-plugin lib to resolve this problem?
There is no straight anwser to your question, or there is at least some misunderstanding.
Even if it's not really impossible, you try to use a tool for another goal that why it was designed.
Maven : build tool
As per doc, maven a build and "project comprehension tool", aimed toleverage the management of softwares. In a few words : it's related to Build phase (development).
So, maven-dbunit-plugin provided features to help you during test / dev of your program : batch, webapp, .... or wathever you want.
Loading data
You are (or you seem) looking for a library that read data from an xml file, during Run Phase (production) and load them into a database.
There hopefully is a lot of way to achieve that, depending on your needs : do you have to make some operation on data before ? Which database are you using.
Here a few list of ideas :
Import Data into MySQL
http://www.mssqltips.com/sqlservertip/2899/importing-and-processing-data-from-xml-files-into-sql-server-tables/
INSERT INTO XMLwithOpenXML(XMLData, LoadedDateTime)
SELECT CONVERT(XML, BulkColumn) AS BulkColumn, GETDATE()
FROM OPENROWSET(BULK 'D:\OpenXMLTesting.xml', SINGLE_BLOB) AS x;
Import Data into SQL Server
Import XML file into SQL Server without BULK
SELECT *
FROM OPENROWSET('MSDASQL',
'Driver={Microsoft Text Driver (*.xml)};DefaultDir=C:\Radu\test.xml;',
'SELECT * FROM [test.xml];' )
As a last solution, you may use dbunit, as a dependency, and call internal method, but once again, this is not the main usage of this library.
Tried to integrate asana API with java,struts project.
By using javasana class i succeeded to get workspaces,users etc
Now my requirement is to add tasks to asana.So i tried to configure API using following configuartion with th help of mvn repositories. http://mvnrepository.com/artifact/net.joelinn/asana/0.5.4
So included following jars in lib folder
1)asana-0.5.4.jar
2)guava-15.0.jar
3)jackson-jaxrs-1.9.13.jar
4)jersey-client-1.17.1.jar
5)junit-4.11.jar
Now its showing method not found error
java.lang.NoSuchMethodError:
org.codehaus.jackson.map.MappingJsonFactory.setCodec(Lorg/codehaus/jackson/ObjectCodec;)Lorg/codehaus/jackson/JsonFactory
Code i wrote for adding task
Asana asana=new Asana(apiKey);
asana.tasks().createTask(new TaskRequestBuilder(workspaceId,"project-followup").addFollower(followassigneeuserId).notes("The task is to follow up user on project system").assignee(assigneeuserId));
may i know where i am wrong?
The jackson jar
3)jackson-jaxrs-1.9.13.jar
depends on two jars
* jackson-core-asl
* jackson-mapper-asl
which you can again get from the above link, If you include those every thing fine
I'm working on the client side of a project that is using DropWizard. Unfortunately what I'm experiencing is that for me to make a change to assets I have to stop the server, package the assets with maven, and then rerun the server or the assets will not be updated.
I tried adding dropwizard-configurable-assets-bundle but I'm still seeing the same behavior. Here's the service after adding it:
Service.java
public void initialize(strap<ServiceConfiguration> strap) {
// Assets
strap.addBundle(new ConfiguredAssetsBundle(
"/dashboard/app/", "/dashboard/", "index.html"
));
// Redirect /dashboard to /dashboard/
strap.addBundle(new RedirectBundle(ImmutableMap.<String, String>builder()
.put("/dashboard", "/dashboard/").build()));
}
I'm currently running mvn package && java -jar target/pack.jar server config.yml. I tried using Eclipse but I was having to restart it manually and it wasn't repackaging for me so it was slowing things down even further.
This whole process is reaaaally slowing me down and I'm hoping it's just my ignorance to the world that is Java.
In my Intellij Idea, i am using JRebel plug-in for this purpose. JRebel also supports Eclipse.
If your assets are packaged under src/main/resources then they should just update automatically with Eclipse without a restart being required, so long as you're running the executable service main() from within the IDE.
You may need to check that your Maven plugin is set to "generate-resources" on changes but that is just the default setting so should be in place already.
What you're describing is definitely possible in Eclipse - I have personal experience of making resource changes (e.g. change and save an HTML asset) and then seeing an immediate update upon doing nothing more than a browser refresh.
We're converting a buildfile from ant to a maven plugin. We're trying to start/stop a database (hsqldb) in a maven plugin.
We succeeded to start the database. But we think that the plugin stops the database when the plugin is executed. The database should keep on running after the execution, but it seems to stop right away.
Our guess is that we should use the 'fork' and 'spawn' attributes (they are also in our build.xml from ant), but we don't have an idea how to implement them in our java class from our DatabaseController (which extends from AbstractMojo).
Any ideas?
We're using hsqldb, thisis the code how we initialize it:
hsqlServer = new Server();
hsqlServer.setLogWriter(null);
hsqlServer.setSilent(true);
hsqlServer.setDatabaseName(0, "database");
hsqlServer.setDatabasePath(0, "file:data/database");
getLog().info("Starting server!");
hsqlServer.start();
When we run the plugin, the database starts, we even managed to create tables and write data to it. Then the plugin stops, and the server stops automatically with it.
If we run another plugin, one to stop the server, we always get a nullPointerException at this line:
hsqlServer.stop();
Kind regards,
Jeroen
One thing you can do is, looking at existing maven plugins that does the forking of new java processes. Maven-surefire-plugin for one, do something similar. Surefire has a configuration (which will be specified in the pom.xml) called forkMode, which controlls the forking.
You may have to go through the source (svn checkout the code) of the plugin to figure it out.
I'm not much familiar with surefire much. But as a start, you may read the following class (#fork( Object testSet, Properties...)!
./maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
Any code executed in maven is forked in another process. I worked with processes in some projects realm, it doesn't have a clear documentation about that.
You could call your code something like that:
Thread.currentThread().setDaemon(true);
hsqlServer = new Server();
hsqlServer.setLogWriter(null);
hsqlServer.setSilent(true);
hsqlServer.setDatabaseName(0, "database");
hsqlServer.setDatabasePath(0, "file:data/database");
getLog().info("Starting server!");
hsqlServer.start();
With an daemon thread, maven could thing witch your code is to be runned in background.
It´s supposition, but you could try it.
I'm doing my 1st steps in Android/GoogleApp, and I'm trying to explore the Jumpnote example:
http://code.google.com/p/jumpnote/
I was able to import the Android and Appengine projects to eclipse, but encountered the following issue when trying to run the Jumpnote-web part (android runs well).
When running the web part there is an error Main type is not specified which AFAIK implied that this project is missing a main function.
Is that indeed the case for jumpnote example and I need to manually add it, or am I missing something else?
Go to run Configuration
select JumpNoteWeb run configuration
You see in the main tab your project name and below it says main class
In the main class, put "com.google.gwt.dev.DevMode"
it should now run
*When I had this problem I also need to make sure that I put the src.shared folder into my project and had to change my build order so the app engine sdk, gwt sdk, and jre would build first