specific or abstract when issuing a event in MSA? - microservices

We have blog service that can update the title of the blog.
And we have search service that allows you to search for blog title.
In this system, when blog title changed, search service should put the blog title to search engine
I am trying to implement this requirement using a message system.
The blog service should issue event when the title is updated. There seem to be two options.
Specific. issue BlogTitleUpdatedEvent with blogId and title
Abstract. BlogUpdatedEvent with blogId
First option is specific, It is clear what event occurred but each time another event is added, we need to create one.
Second option is abstract, so blog service not dependent on other services. because we don't have to know what other service doing. we just issue blog update event. but other service should be request data for each requirement
When we try to build message system in MSA, which one would be better? I would appreciate it If you could tell me about your experience.

Related Stackoverflow blog.
You could send both events, but the answer comes down to what you need to consume, and how you plan on using those events.
Ideally, you'd include the title (and other metadata) in the event. Otherwise, you would only know something was updated for that blog. Then you need to query for that blog, and parse everything and perform a diff to see what actually changed (or do a whole document overwrite in your search index).
If you send exactly what is changed, you would reduce the load on the search service / indexer, and save yourself a lookup query to the blog service.

Related

Document create software using AngularJs?

I am currently developing a web application using Laravel and AngularJs. One of the requirement in document module is, that they want to create, update documents like Google Docs or Zoho Docs.
I googled but couldn't find a solution.
How can I implement it? It seems like that it is a big task.
It is a really big deal. There is an example flow how an implementation could work like:
keep track every change (for example keydowns) on client side
create a patch message
send the patch to a backend server
notify all of the other users that the content has been modified and send the patch to apply
apply the patch on the client
repeat each and every time something is changing
Of course the backend has to accept messages from all of the clients and distribute it to all of the other ones which has the same document open. Google Docs is working in a similar way you can check it in the developer tools of Chrome for example or check operational transformation.
Edit
Use the API of one of the mentioned services instead of building an own module. https://www.zoho.eu/docs/zoho-docs-api.html
For goole docs you could use the following with angular js:
https://developers.google.com/drive/v3/web/examples/

Auto post from joomla article to Instagram?

we want an auto publisher , whenever an joomla article is published, automatically publishes the article data such as title, image, description etc, on the Instagram. If this possible or not?
Yes this is possible with a content - plugin. You can use the onContentAfterSave event to do that.
Within this very callback you get the Article as parameter, so you can access all details of it, to create the webservice call.
There are some more events which plugins can listen to. Joomla Plugins are pretty simple to develop, basically they consist of an describing xml and a php file and you can find documentation here. To get started you should have a look at an existing content plugin (/plugins/content/*).
The actual call to instagram can be done using curl.
Looking out for an Instagram api, I found that: github.com/cosenary/Instagram-PHP-API and instagram.com/developer. I hope that can help you with the webservice call.
There is an extension in JED that will lessen your burden of coding. You can have a look at it here http://extensions.joomla.org/extensions/extension/social-web/social-display/jfbconnect . Remember thats a Paid extension.

Gigya gamification for poll

I am using GIGYA gamification custom actions for a POLL in a website. As per the documentation I have created a Custom Action. Then, I created a html page which has the poll layout and included Gigya's api key and used gigya.gm.notifyAction function. My questions are -
This function as per my understanding will notify the custom action. How can I and where will i see the results. Do i need to use another function to get the counts.
Can someone provide a small custom JS code for Gigya.
We do have an example site which will show you how this is implemented. Although the site uses loyalty, you should be able to adapt it to what you want it to show using gamification. The url is: http://raas-demo.gigya.com/
You can also download the websites source code as well.
This will explain about:
http://developers.gigya.com/display/GD/Loyalty
Kind Regards
Nadeem R

Event sourcing data flows for a simple web application

Read through a lot of the CQRS/DDD/ES blog posts, still unsure a simple blog engine would work.
In the case of publishing a post, for instance...
User clicks publish → PostPublished event added to Event Store → Triggers the Aggregate Objects (for instance, Archive and FrontPage) to be updated to reflect most recent event.
On the user side, I click the publish button and am redirected to the front page of my blog, where I expect to see the new post on the top. However, if the Event Store is behind (say by 1-2 seconds), my new post will not show up.
Is the answer to have a system that waits for all the Aggregates to be updated before returning the redirect to the user?
Your question is how to deal with eventual consistency, and there really isn't a fool proof one size fits all solution.
The best solution IMO would be to simply put a 'Post published, it will show up in a moment' notification up there. Some people will also do queries over and over until they get the recent change THEN display the front page. Which delays the front page for a second or two if the ES is behind.

How to get data out of entity in script in CRM 2011

I have 2 entities (for this example) in CRM 2011 - Account and Case. The Account holds all of our clients, the case holds individual work actions for an account. When a case is created one of the input fields is the Account.
What I would like to do is upon the user selecting the Account, execute some javascript to look up the account entity to display some additional information.
So far I have got the javascript working that triggers the onchange event of the Account field, and it correctly gets the selected Account, but I don't know what the next step is.
I'm new to CRM so don't really know if what I'm asking is actually sensible, if there is a better way then please let me know.
Thanks!
For the record, the way you were thinking about doing things would be completely supported, and TechHike's method is supported in CRM 4, not CRM 2011. Steps you would take:
Use CRM 2011's web resources to upload a script file that does what you want.
Use the form editor to make your javascript method from step one fire when the Account field changes on the form
Make a request to CRM's REST endpoint (http://msdn.microsoft.com/en-us/library/gg334767.aspx) to retrieve the details of the account selected
Use the results to populate fields on the form, show a popup with details, etc.
There are plenty of examples of caling the REST endpoint from JavaScript in the SDK (http://msdn.microsoft.com/en-us/library/gg309408.aspx). Good luck!
Matt's post above contains everything you need to know, but you might also find the blog post below useful. It basically describes the same scenario where you have a 1:n relationship (such as Case and Account) and details how you can pull information from a specified lookup (e.g. account), using the REST endpoint (as Matt has already mentioned) and display it on the form.
http://community.dynamics.com/product/crm/crmtechnical/b/crminthefield/archive/2011/02/07/showing-related-information-in-a-crm-2011-form.aspx
The blog post includes a link to download a CRM2011 solution already built to give you something to look at how they've achieved this (useful if you're new to CRM2011).
There are two ways to do this, and you may be best to do them both in parallel:
on the Account > Case relationship edit the Mappings. When a user goes to an Account and uses the left navigation to look at Cases (or a grid of Cases on the form) then hits "Add New Case" they are creating a Case from inside the "context" of the Account. You can copy any fields you want to from the Account to the Case record at this point - the Mappings define what field from the Account are copied to which target field on the Case. This will always be the most robust, easiest way to do it but relies on the user starting in the right place.
on the Case for you could also add an onChange script to the Parent Customer lookup to fetch the data from the parent record. I think Stephen's link is probably the best way to do this as it does not copy the fields but allows the user to see them anyway, which is better database design (from a purist standpoint) and means the user always sees current info about the Account rather than possibly out of date stuff. Alternatively if you actually need to copy some fields (maybe the customer's normal SLA say) so that you can use these in other such as scripts or workflows on the Case then have a look at this article: Disabling the selection of contacts for opportunities all the way
Although this is about a slightly different topic, the script there fetches the Account details of the parent Contact - you want to fetch values from a parent (llokup) field so the approach is the same, just different in the detail
There are various ways to do this but I would recommend doing it the supported way, without javascript. This may not be as pretty but it is likely much easier. The scenario would be to add a left navigation link to the case entity that when clicked will update the content area to show the details of the account.
To add a link to the left navigation you will need to configure the isv.config file to have an extra link for the case entity.
Here's an example:
http://support.sfusion.com/kb/hosted-microsoft-crm-4/how-do-i-modify-the-isv-config-file-in-microsoft-crm-4/
You can also lookup isv.config customizations in the SDK, found here:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=82e632a7-faf9-41e0-8ec1-a2662aae9dfb&displaylang=en
Next you will need to create a custom aspx page in the ISV folder of the web server. This page will display all the information about the account that you want to show the user when the left navigation link is clicked. The ISV.config as an xml property that allows you to pass all the context params to your page on the querystring. Make sure when you create the link to turn on this attribute.
Now the only tricky part is that in the page you will need to use the CRM web service to display all the account details that you interested in showing the user. I won't do into details on this. You can find great tutorials on the web or in the SDK if you haven't done this before.

Resources