All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.windowsazure.messaging.TemplateNotification Maven / Gradle / Ivy

Go to download

Azure Notification Hubs Java SDK for interacting with the data and management plane operations.

The newest version!
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------

package com.windowsazure.messaging;

import org.apache.hc.core5.http.ContentType;

import java.util.Map;
import java.util.Iterator;

/**
 * This class represents a template notification.
 */
public class TemplateNotification extends Notification {

    /**
     * Creates a new instance of the TemplateNotification class.
     * @param properties The properties for the template notification.
     */
    public TemplateNotification(Map properties) {
        StringBuilder buf = new StringBuilder();
        buf.append("{");
        for (Iterator iterator = properties.keySet().iterator(); iterator.hasNext(); ) {
            String key = iterator.next();
            buf.append("\"").append(key).append("\":\"").append(properties.get(key)).append("\"");
            if (iterator.hasNext())
                buf.append(",");
        }
        buf.append("}");
        this.body = buf.toString();

        this.contentType = ContentType.APPLICATION_JSON;

        this.headers.put("ServiceBusNotification-Format", "template");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy