azure service bus & dynamics crm integration - java

I am currently working on a POC where I am draining messages from an azure queue - that is populated through a dynamics CRM plugin during DB CRUD operations.The queue drain operation using a java client fails with the message :
<Error>
<Code>500</Code>
<Detail>
The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101. TrackingId:add85f1a-a249-4e69-b284-ad879cd29968_G27, SystemTracker:scsqueue1-ns:Queue:scsqueue1, Timestamp:7/6/2016 7:21:49 PM
</Detail>
</Error>
The java client can be found here :
https://github.com/sharpcodes/scs-bus-demo
However using a C# client works

I can't see the obvious issue in your code on GitHub. However, per my experience, I suggest that you can try to use the tool Fiddler for debugging the rest request from your code, because the Azure Service Bus SDK for Java is wrapped the REST APIs, such as Receive and Delete Message (Destructive Read) for draining messages.
Meanwhile, there are three ways below in Java for draining messages via the operation Receive and Delete Message on Azure.
Using Azure Service Bus SDK for Java, please refer to the section Receive messages from a queue of the tutorial "How to use Service Bus queues" to do with default mode ReceiveAndDelete.
Using Azure Service Bus REST API for Java with http client, please refer to the section Receive and delete a message from the queue of the tutorial "Service Bus brokered messaging REST tutorial".
Using JMS API with AMQP 1.0 in Java, please refer to the section Coding Java applications of the tutorial "How to use the Java Message Service (JMS) API with Service Bus and AMQP 1.0" to see the function SimpleSenderReceiver().

Thanks to peter for guiding on this..
Looks like there is an issue with the dynamics crm-azure bus plugin that prevents java/node-js clients from draining the queue using SDKs or RestFul calls.
Using JMS client seems to do the trick. Another way would be to have a C# middleware that could be wrapped by Java/Node.
Here is the reference to the issue : https://github.com/Azure/azure-sdk-for-php/issues/823

The issue is closed now as a fix had to be made by Azure Java SDK team to escape characters correctly..

Related

What is the equivalent of BrokerProperty "setScheduledEnqueueTimeUtc" in AMQP/JMS world

I'm working on a java application that needs to send message to Azure service bus such that message is available to the next process after certain delay.
Using Azure sdk, it can be achieved by setting setScheduledEnqueueTimeUtc BrokerProperty on the Brokered message, but I'm unable to find an equivalent of this in AMQP/JMS world.
Using Message.setProperty with a key,value pair results in property being put under application property and the message appears in queue immediately.
Is there a way to achieve this delay?
JMS 2.0 specifications define "delivery delay" feature which lets a message to be delivered after specified time duration. See here http://www.oracle.com/technetwork/articles/java/jms2messaging-1954190.html for more details. You will need a messaging provider that implements JMS 2.0 specification.

Apache Kafka: How to send data from different machine

I started recently studying Apache KAFKA, for IOT application I am working on. Right now, I am having devices which are already sending data to server using HTTP POST and GET.
After struggling a lot for at-least 5-6 hours. I am not able to figure out how we can send data using HTTP POST to Kafka server.
Also, are there any good real life examples present on web which shows detailed configuration of KAFKA cluster that will be really helpful for beginner like me.
First, you should know that sending messages with HTTP is suboptimal, compared to Kafka native TCP-based protocol.
But let's say that you know all that and still want to use HTTP.
You need to bring up the Kafka REST Server in order to receive messages over HTTP.
Given that you're still learning, maybe the best course of action would be to use Confluent's Kafka distribution that comes with the REST Proxy and has a great documentation.
BTW Confluent is for Kafka what Datastax is for Cassandra, or Hortonworks/Cloudera is for Hadoop. It's a young company founded by the very creators of Kafka from LinkedIn.

How to configure SNS delivery status with the AWS SDK?

If you create an SNS Topic and, in the Amazon Console, open the Delivery Status options under Other topic actions, you can see this:
As you can see, it's possible now to get SNS delivery status feedback by configuring success and failure IAM roles. This works fine and I can see all the logs in CloudWatch for all published messages to each subscriber.
What I can't do is to set these values with the Java AWS SDK, is there any way of doing this?
I'm using aws-java-sdk:1.10.23 (latest as of now)
As #david-murray pointed out in the documentation, this is the solution to configure the feedback for HTTP endpoints:
amazonSnsClient.setTopicAttributes(topicArn, "HTTPFailureFeedbackRoleArn", "arn:aws:iam::1234567890:role/SNSFailureFeedback");
The same idea can be used for Application, Lambda and SQS.
My mistake was trying to set all of them with a single call like the form in the screenshot does by using:
https://eu-west-1.console.aws.amazon.com/sns/v2/SetMultiTopicAttributes
Although this doesn't seem to be present in the SDK at the moment, 4 separate calls will have the same effect.
Thanks!

push service change to client

I have a requirement:
I have to customize a push notification to the subscribers when a service changed.
I googled and found only IOS, android have the function with their platform,but that's not what I need. I'm using the play2.
how to do that?
With play2, the way to go is to push data to the client browser using either Server Sent Event or Websockets. Play supports both technologies.
WebSocket will allow you to have a two-way communication whereas SSE only have one way. For more information, I invite you to follow the documentation here for Scala or for Java

calling a method on client side on update in database

I have a database in my sql and I have multiple clients using that database.
whenever a column in the database is updated I want to call the corresponding java method on the client side. Basically this is the message system, when user get new message I want to give him a notification. Is this the right way to do it? If yes how do I implement it. If not what would be the right way to do it?
Any help appreciated
Thanks
There are messaging frameworks for such reason for example :
Jabber
UDP multicast (http://download.oracle.com/javase/1.4.2/docs/api/java/net/MulticastSocket.html)
JMS (http://activemq.apache.org/)
No, this is not the right way to do it. To send messages, use message-oriented middleware (MOM), using JMS. There are free JMS implementations available (like ActiveMQ, for example).
You might find interesting the following blog post and thread: http://www.unlimitednovelty.com/2009/04/twitter-blaming-ruby-for-their-mistakes.html
The blog was written when Twitter has changed its messaging system platform from Ruby to Scala. It generated an ineteresting flame about messaging systems between experts...

Categories