Usage of Azure Notification Hubs templateName - c#

I've created a sample App with Cordova and a Mvc5 application that talks with Azure Notification Hubs.
Registrations are handled by the backend because tags must be secured.
We have used three different templates registered from the backend for the iOS,WP8 and Android platforms; the backend can send a push notification with a $message payload using sendtemplatenotificationasync.
It's working but we have not used the templateName.
Reading the Registration from your app Backend documentation , I've found this:
"You can identify the templates by using the TemplateName property of
the registration".
Once I have successfully created a Registration with a templateName what can I do with it?
I expected to find an API Send method to be able to specify, besides the tags or tag expression, a specific templateName; I have not found anything like this.
What's the meaning and the general use case of templateName?

The template name is just a descriptive label for the template registration. It is not intended to be used to programmatically identify registrations and therefore there aren't any API methods that use the template name. You shouldn't use it for anything other than debugging or logging. (I don't set template names at all...)
You can check the official ANH Java SDK on GitHub for example: If you search for "templatename", you won't find any usage other than setting the template name for a registration.
All your templates should use the same template parameters, if they are intended for the same notification type. Then you just send a template notification with all the parameters to all platforms at once. That is the use case for template registrations. As far as I know, you can have additional parameters for specific platforms, registrations that don't specify a parameter, just won't receive it. Just make sure you send all parameters that are defined in all templates.
If you wan't to distinguish between registrations with different templates, use tags, e.g. for distinguishing platforms use tags like "Platform:Android", "Platform:iOS", etc. Or for distinguishing templates with different parameters use "Template:PersonalMessage", "Template:GroupMessage", "Template:BroadCast", etc...

Let's say you have iOS and Android clients. For iOS you would register with template that is compatible with iOS, and for Android you would register with template compatible for Android. Then, when you send your message, it will be formatted accordingly.
We did it even little bit differently compared to Microsoft example. Our clients (iOS or Android) provide template, so backend developers don't need to know those details. More here: http://discoveringdotnet.alexeyev.org/2014/07/registration-for-azure-notification-hub.html

Related

How do I set a default naming convention for subscriptions and queues in MassTransit?

Currently we are tied to a single Azure Service Bus instance for local and the test environment (I would prefer a different setup but It's not up to me). Previously we were using a custom framework that for each topic it created a subscrption with a name that was a mix of the service name and, if the project was run by a dev in his machine, it appended a "local name" to avoid having all the dev local computers and the server instances competing for the same message. So for example for the ShoppingService it created a subscription called ShoppingService for the server instances and in Joe's local machine it created a subscription called let's say ShoppingService-JoeComputer. Right now we are trying to switch from this custom framework to MassTransit because we like the additional features it provides (and also because honestly the custom framework was more buggy than we would like to admit). We followed this video published by Patterson to create the commands, events and consumers and everything works as described:
MassTransit - Using Azure Service Bus
However, we are now facing the competition issue I mentioned before. To solve it we will try to set the custom naming convention we are currently using so the questions I have are:
Is there a way to modify the default naming convention used by MassTransit? We would like to keep most of it where it creates a topic based on the command type name but we would like to add a postfix to both the forwarding subscription and the queue. In other words if we were talking about the submit order command described in the video we would like the subscription name to be "submit-order-joe" and the queue name to be "submit-order-joe" if it runs on joe's machine. We could set up the configuration manually for each consumer/client/publisher but it would be great if we can set it up "globally".
Using the default convention, what happens if there are two commands named "namespaceOne.SubmitOrder" and "namespaceTwo.SubmitOrder"? Based on what we saw it would create two different topics but both subscriptions would be called "submit-order" and both would forward messages to the same queue called "submit-order". That would be confusing and I don't even know if MassTransit is going to consume the commands correctly.
There are two naming conventions in MassTransit. Entity names (which are based upon message type, and would be topics in Azure Service Bus) and endpoint names (which are based upon the consumer, saga, or activity type and would be queues in ASB).
You can specify your own entity name formatter to customize the entity name format, or you can override specific messages.
You can also specify your own endpoint name formatter, described in this video to customize the queue names generated for receive endpoints. Or you can create an instance of the built-in formatters specifying different constructor arguments to include a prefix, include the namespace, etc.

What is the format for Lambda Function in Amazon Web Services Websocket Gateway API route setup?

I am attempting to follow this tutorial for setting up a WebSocket API using Amazon API Gatewway:
https://medium.com/#gavinlewis/getting-started-with-websockets-on-api-gateway-with-net-and-the-serverless-framework-9065f37d06e0
Like in the tutorial, my Lambda application is written in C# with classes for Connect, Disconnect, etc.
Unlike the tutorial, I am using the AWS website to set up the Gateway API. This is where I am stuck. I can't figure out how to "map" the $connect, $disconnect, echo, etc using the website UI:
I am not sure what the format of the value for the "Lambda Function" textbox. It is probably similar to this (from tutorial) but, I get a validation error when I use this value:
CsharpHandlers::App.Disconnect::FunctionHandler
So, what is the proper value I should enter to reference my lambda application, a specific class and a specific method?
Thanks.
In the Lambda Function form field you need to put the ARN of the function you want to proxy the request to.
To modify a Lambda function's default handler, open it in the AWS Management Console, and look for the Handler field under the Function code section (e.g. LambdaTest::LambdaTest.LambdaHandler::handleRequest). Even if you change it tho, you would need to stick to the signature described in the docs.

Microsoft Graph API not exposing certain properties

I've been looking into using the Graph API from Microsoft to monitor a few online Exchange inboxes.
I was reading their documentation here for Outlook Messages but I'm looking for conversationTopic. I know this is exposed in the normal Outlook Object Model; but I don't see it exposed in their documentation.
Has MS exposed this property in their API?
Info as of 9/15/2016
The conversationThread property has only been exposed in group conversations. It hasn't been exposed in a first class manner for a user's messages. This has been exposed on the beta endpoint via extended properties . You'll want to use the PidTagConversationTopic property.
Here's an example call to get this property (you'll just need to add your message id):
https://graph.microsoft.com/beta/me/messages('YOURMESSAGEID')?$expand=singleValueExtendedProperties($filter=id%20eq%20'String%200x0070')
Here it is for easier reading (no URL encoding):
https://graph.microsoft.com/beta/me/messages('YOURMESSAGEID')?$expand=singleValueExtendedProperties($filter=id eq 'String 0x0070')

Generating Google Analytics from a C# Application

I would like to be able to generate Google analytics data that will show me number of startups of my application but also the time it tool for each starup and the average time for all startups. Something like:
Startups 1296
Startup Times
40ms
27ms
128ms
700ms
42ms
82ms
...
...
127ms (Average)
I know it is possible to get the Startups but not sure if it is possible to also get Startup Times. Is it possible to do this and how from a C# desktop application?
I am developing a lib called gappalytics, it allows you to log analytics events for desktop apps. Link to package nuget.org/Gappalytics.
Usage sample: github.org/gapalytics
As long as you can sent http request in realtime (or a narrowly defined offset window) you can use the measurement protocol. I don't think there is a C# client library, but this is basically just a http request with the parameters and and such its language agnostic.
There are a few required parameters - the protocol version (always v1 for now), Google Account ID, a unique Client ID per user or device and a hit type (pageview, screen, event, transaction etc.). Also depending on the hit type you need additional parameters (document location/page title, event category/action/label etc.).
There is a parameter reference with all possible fields, and you can construct hits for testing via the hit builder.
Google Analytics has a "user timings" hit type (basically you pass a description and a duration in microseconds), so the report from your example should be very easily doable.
I don't know C#, but I'm reasonably certain is has a way to format a string as an url with parameters and send an http request, and in the end that's really all you need for data collection with GA.

Modifying SharePoint List Using ASMX WebServices

I am writing a custom piece of code that dynamically creates modified document libraries. I've attempted to create a document library template, which succeeds in the UI but cannot be found via-webservices.
So to get to the point - I am attempting to:
1. Set "Allow Management Of Content Types" on the list.
2. Add a new Content Type (Already Created) to the list.
3. Set the new content type as the default content type.
4. Remove the "Document" content type from the list.
So far I have succeeded in being able to "Apply" the custom content type but the others are evading my grasp. The methods I have attempted are through the Lists.asmx service and the method described here: http://msdn.microsoft.com/en-us/library/websvclists.lists.updatelist.aspx
I tried setting the Flags property and a few other potential candidates with no success and no error messages complaining about what I was trying to attempt.
One limitation is that I do NOT have access to the sharepoint dll where this is living.
Once completed - this would be a plugin living in another non-sharepoint system. The only option to include the SharePoint client dll's would be to perform an ILMerge.
EDIT:
http://msdn.microsoft.com/en-us/library/sharepoint/jj193051.aspx (SharePoint 2013 Web Services)
http://msdn.microsoft.com/en-us/library/ee705814(v=office.16).aspx (SharePoint 2010 Web Services)
and yes - technically the ASMX services sound like they're on their way out: http://msdn.microsoft.com/en-us/library/sharepoint/jj164060.aspx
Edit: Tags are relevant to the question.
use SharePoint Client Object Model. This is a library that wraps calls to webservices that allows among other things to batch commands.
The operations you mention are all available.
here is a link to an article that explains Client Object Model:
http://www.codeproject.com/Articles/399156/SharePoint-2010-Client-Object-Model-Introduction
The article focus on ListItems but you can also interact with list properties, even web properties if you want.
Please note that you don't need to run Client Object Model from your sharepoint server. Note the "Client" part in the name.

Categories

Resources