How To Use ElasticSearch In Vertx Java With EventBus? - java

Can Somebody let me know how to use elasticsearch in vertx for java.I have used eventbus but i couldn't able to get it done. New to Vertx. Any help will be appreciated.
I have tried it this way. Index name is movies. Index_type is movie. And ID is 1. I want to delete this record.Using Default Configuration.
JsonObject delete = new JsonObject();
delete.put("action", "delete");
delete.put("_index", "movies");
delete.put("_type", "movie");
delete.put("_id", "1");
vertx.createHttpServer().requestHandler(req -> {
vertx.eventBus().send("et.vertx.elasticsearch", delete);
})listen(8080);

Check this out, it's a vertx service for Elasticsearch...that should get
you going.
https://github.com/englishtown/vertx-elasticsearch-service

This repo is tasted with elastic search 6.1. Originally Forked from ef-labs/vertx-elasticsearch-service but diverged a lot since then. It will good to get started with ES with Vert.x:
https://github.com/hubrick/vertx-elasticsearch-service

Related

How to implement batchWriteItem for deleting data in DynamoDB [Java]?

I am very very new to DynamoDB. I have a lot of stale data in a table. I want to delete it in batch. What I have done till now is that I have queried the Table using GSI. Now, since there is not much relevant content of using batchWriteItem in Java, can someone please help me. A code example would be appreciated.
I have tried googling a lot and have read AWS documentation for batchWriteItem. But they don't have any code examples as such.
You have to use addDeleteItem in the BatchWriteItemEnhancedRequest
var builder =
BatchWriteItemEnhancedRequest.builder();
items.forEach(item -> builder.addWriteBatch(WriteBatch.builder(ItemEntity.class)
.addDeleteItem(<key or item>)
.build()));
enhancedClient.batchWriteItem(builder.build());
All of this is from the v2 sdk version

Azure App Configuration Feature Management

I am looking for a solution using Maven and Java (Not Spring) where I can upload all my Key and labels and flag value by Json to deploy.
When I configure my project in Jenkins it should apply all the values which are changed.
Kindly provide me some directions, I tried lot with less material on this topic
I managed to workout the solution. Basically following this Microsoft Azure Link
, but not completely solved my problem by this link though. Below is the Code Snippet which solved my problem. Code is not testable or productionable , this is just for reference.
public void process() {
String value = "{\"id\": \"test\", \"description\": \"Sample Feature\",\"enabled\": false,\"conditions\": { \"client_filters\": []}}";
DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build();
ConfigurationClient configurationClient = new ConfigurationClientBuilder()
.connectionString(END_POINT)
.buildClient();
final ConfigurationSetting configurationSetting = new ConfigurationSetting();
configurationSetting.setKey(format(".appconfig.abc/%s", "abc"));
configurationSetting.setLabel("lable");
configurationSetting.setContentType("application/vnd.microsoft.appconfig.ff+json;charset=utf-8");
configurationSetting.setValue(value);
configurationClient.addConfigurationSettingWithResponse(configurationSetting, NONE)
}
Key points here is ".appconfig.abc" , At this point of time we don't have direct call to Feature Management , but we can add Key and labels to configuration as I said in the code snippet but with the Key as ".appconfig.abc" which you can get this info from portal. And the value should be a Json object, how we make this Json is upto you really.
Overall so much of information around the sites but none of them are connected in Java world for Azure. May be helpful to any one.
End Point , one can get from the Configuration Access Keys.

get all issues stored in jira

hi i want to get all issues stored in jira from java using jql or any othere way.
i try to use this code:
for(String name:getProjectsNames()){
String jqlRequest = "project = \""+name+"\"";
SearchResult result = restClient.getSearchClient().searchJql(
jqlRequest, 10000,0, pm);
final Iterable<BasicIssue> issues = result.getIssues();
for (BasicIssue is : issues) {
Issue issue = restClient.getIssueClient().getIssue(is.getKey(), pm);
...........
}
it give me the result but it take a very long time.
is there a query or a rest API URL or any other way that give me all issues?
please help me
The JIRA REST API will give you all the info from each issue at a rate of a few issues/second. The Inquisitor add-on at https://marketplace.atlassian.com/plugins/com.citrix.jira.inquisitor will give you thousands of issues per second but only the standard JIRA fields.
There is one other way. There is one table in JIRA database named "dbo.jiraissue". If you have access to that database then you can fetch all the ids of all issues. After fetching this data you can send this REST request "**localhost/rest/api/2/issue/issue_id" and get JSON response. Of course you have to write some code for this but this is one way I know to get all issues.

LinkWalk in RIAK

I have started working on a RIAK project via Spring Source.
according to their specifications linking between objects and then linkwalking is very simple.
I am saving 2 objects, linking between them and then trying to retrieve the data:
MyPojo p1 = new MyPojo("o1", "m1");
MyPojo p2 = new MyPojo("o2", "m2");
riakManager.set(bucketName1, "k1", p1);
riakManager.set(bucketName2, "k2", p2);
riakManager.link(bucketName2, "k2", bucketName1, "k1", tagName);
System.out.println(riakManager.get(bucketName1, "k1"));
System.out.println(riakManager.linkWalk(bucketName1, "k1", "_"));
the problem is that after the link, the content of the source ("k1") is deleted, only the link stays. This is the printout:
null
[MyPojo [str1=o2, str2=m2, number=200]]
any idea why link operation deletes the value from the source?
if I try to set the sources value (again) after the link, then the link gets deleted...
thanks,
oved.
Riak requires that the link and the data are stored in one operation. You can't update one without the other (at the moment).
So any time you set the link the operation must also write back the data. I don't know does the Spring adapter take that into account. I did see some messages between the Riak and Spring developers about this, but don't know if anything was fixed yet.
But in any case I am also tending towards using the native Riak Java client rather than Spring.
have decided to abandon the spring adapter. it seems it doesn't have good enough support.
using the RIAK java client instead.
anyone think otherwise?

How to create outlook task request in java

I would like to know how to create outlook "Task Request" in java.
Here is another Java lib: http://moonrug.com/
I have used an earlier version of this API in my previous job. It is a commercial product.
Trying to code purely from memory and looking at the examples provided by the Moyosoft website. I have no means to compile or execute this. But you will get an idea on how to proceed
Outlook outlookApplication = new Outlook();
// Get the Task folder where the task has to be created
OutlookFolder taskFolder= outlookApplication.getDefaultFolder(FolderType.TASKS);
//Creating a new Task
OutlookTask task = new OutlookTask (taskFolder);
task.setSubject("New Java Task"); //Name of the Task
task.setStart(new Date()); // creating task with current server time
task.setStatus(TaskStatus.NOT_STARTED); //task has not yet started
task.setOwner("owner's_email#example.com"); // I don't whether this is name or email.
task.setReminderTime(new Date()) //set a reminder time, set appropriately
task.setDueDate(new Date()); //deadline for the task completion, set appropriately
// and so one.
The following APIs should help you.
http://www.moyosoft.com/joc/javadocplus/?docclass=com.moyosoft.connector.ms.outlook.task.OutlookTaskRequest
http://www.moyosoft.com/joc/javadocplus/?docclass=com.moyosoft.connector.ms.outlook.task.OutlookTask
The complete java docs can be found here. It is not very well documented but the API names are self explanatory.
http://www.moyosoft.com/joc/javadocplus/
Their site also have a few code examples which was helpful in figuring it out.
I hope this is helpful. I do not have access to these APIs now, therefore I have no way to provide code examples.

Categories

Resources