Announcement: A New Perspective

Sorry guys, I haven’t posted in the last four months or so. It is because I relocated myself from New Zealand to China. I am still having a base in New Zealand but my work is in China for now.

I am lucky to be an IT consultant. It allows me to continue my career even after moved 10,000+ km!

If the meaning of life is memories. The relocation definitely created a few new memories. I will share them in my future posts.

The announcement does stop here. My new blog site is up. I will blog from http://blog.kelvinbytes.com from now on. PLEASE SUBSCRIBE. Don’t worry I will gradutely move old posts from my old blog site to the new one. So everything will be in the same place.

If you want me to cover a specific topic please request by creating a GitHub issue.

Dynamics 365 CE: Integration via Azure Aware Plugins

In a previous post, I talk about integration via Azure Service Bus Queues. In that scenario, the Dynamics 365 CE is the data destination, i.e. A survey portal sends data to a Dynamics 365 CE instance. What do you do when Dynamics 365 CE plays a data source role in a data integration setup? For example, you Dynamics 365 CE wants to send an order message to a dispatch system.

Service Endpoint

By using an Azure enabled plugin, you can send a plugin execution context to a registered service endpoint. Microsoft has very nice documentation from how to register a service endpoint, to how to bound an Azure enabled plugin with a service endpoint.

Once a message lands in an Azure Service Bus queue, consuming an Azure Service Bus Queue messge is standard.

WebHooks

WebHooks work exactly the same way as Service Endpoints. The difference is who is the receiver of the (plugin context) messages. A Service Endpoint has to be an Azure Service Bus whereas WebHooks can be any 3rd party or bespoke web service endpoint.

Terminologies

SAS: Shared Access Signature

Power Knowledge: How to Express Yourself 1

Many people think the art of expression is just to render ideas with clarity. In fact, it is just level 1.  The goal is to make people like you and change their mind and behaviours.

Say the Conclusion First

Starting a talk with a conclusion never fails me. Then support your conclusion with reasons. “Global warming is harming the human race is because 1… 2… 3… The benefit of reducing carbon emission is A… B… C…”. With the conclusion in mind, it will be easier for your audience to enjoy the rest of your convey. You can re-iterate your conclusion again at the end.

Cut Out the Crap

If you are in a business meeting where the goal is to present facts or problem-solving.  It is unnecessary to add personal feelings, like “I couldn’t believe it when I heard Joe Blow’s regulation “. Instead, you should cut to the chase with findings and suggestions. “Joe Blow’s resignation will impact a lot of our clients. Therefore, we should kick off the hand over process immediately, and inform all of this client in a week of time”

“Cornerstone” Concepts

When the content is complex and difficult. You should deliver the content in multiple iterations. You can start by laying out a few “cornerstone” concepts. The “cornerstone” concepts are the foundation of the following up knowledge transfer. For example, if you want to teach someone machine learning, you should first introduce the concepts of datasets, supervised learning, unsupervised learnt, classification, and regression. Then you can dive deep into algorithms and blah.

Less is More

The less the time the more you need to prepare. If you only have 1 minute in a morning standup meeting. Don’t see it as a 60 seconds session. You should see it as three 20 seconds blocks, and prepare your content for each block. This way your expression will be more seamless. For example, the first 20 seconds is for achievements, and the seconds 20 seconds is for the next steps, and the last 20 seconds is for asking for support.

 

Dynamics 365 CE: Event Driven Integration via Azure Service Bus

The Event-driven integration approved is not new. I have covered the topic before in a previous blog post. This time I will go over the topic again in a new context. Microsoft Azure service bus queue will make the development easier and it is a more reliable platform than many on-premise setups.

The scenario is that you have a survey portal. It wants to push survey data to a Dynamics 365 online instance on a survey submission. In my previous post, I was talking about setup up a webhook handler Web API and a staging database. We can replace both of them with Azure service bus queues.

Like many other software services, an Azure service bus queue takes an input and produces an output. The input is an Azure service bus notification. The output is a listener, and the easier way to implement a listener is to use an Azure Function.

Cost

The Azure Function consumption plan is a lot cheaper and the first 1 million requests per month are free. The default timeout of a consumption plan Azure Function is 5 minutes and you can extend it to 10 minutes. The problem is that sometimes an Azure Function will doze into sleep before reaching the timeout and it will not wake up by itself.

Queue VS Topic

The main difference is that the Azure Service Bus Queue can only have one listener whereas the Azure Service Bus Topic can have multiple listeners.

Session enabled Azure Service Bus Queues

Azure Service Bus Queue and Azure Function are a good combination but a session enabled Azure Service Bus Queue cannot trigger an Azure Function! It is a known issue and a frustrating one. Microsoft is currently working on it.

Azure Function Version 2

Azure Function version 2 only support libraries compatible with the .Net standard. It means you cannot use the CrmSdk.XrmTooling.Core library anymore.

The good news is that you don’t need the CrmSdk.XrmTooling.Core library to consume the (relatively) new Dynamics 365 WebAPI endpoints. For authentication, you can use the ADAL.NET library if you code in .NET. You may have better luck with older versions of the library, version 2 or version 3. The HttpClient class represents the communication channel. If you want an extra kick in productivity, I will highly recommend David Yack’s Xrm.Tools.CRMWebAPI library.

Error Handling

Microsoft Azure Service Bus Queue can handle exceptions out of the box by sending failed messages to a dead letter queue.

Logging

The classic logging view will sometimes fail to load. Therefore I will highly recommend you to turn on Azure Application Insights. The first 5 GB of Azure Application Insight ingestion per month is free. It is literally free for a small to the medium system. For one system I built, there are 9 Azure Functions and thousands of logs per day and we are not hitting that 5 GB limit.

If for any reason, you just cannot use Azure Application Insight, you can download log files locally to have a look.

 

 

Power Knowledge: What We Can Learn from Veterinarians?

What is the difference between livestock vets and companion animal vets? They both treat live animals. However, the customers of livestock vets are more price sensitive. Livestock animals are commodities. If the cost of the treatment costs more than the value of an animal, the owner will likely to choose to put down the animal. On the contrary, the owners of companion animals are more personally attached to the animal. Therefore, they are more willing to pay more to get their pets fixed. As the result, a companion animal vets will have more funding to research and try new techniques. The enlightenment here is if you want to extend your career advancement, you should choose which field carefully.