org.apache.activemq.artemis.utils.TypedProperties

Here are the examples of the java api class org.apache.activemq.artemis.utils.TypedProperties taken from open source projects.

1. LocalGroupingHandler#sendProposalResponse()

Project: activemq-artemis
File: LocalGroupingHandler.java
@Override
public void sendProposalResponse(final Response response, final int distance) throws Exception {
    TypedProperties props = new TypedProperties();
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, response.getGroupId());
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, response.getClusterName());
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE, response.getAlternativeClusterName());
    props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
    props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
    props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
    Notification notification = new Notification(null, CoreNotificationType.PROPOSAL_RESPONSE, props);
    managementService.sendNotification(notification);
}

2. RemoteGroupingHandler#receive()

Project: activemq-artemis
File: RemoteGroupingHandler.java
@Override
public Response receive(final Proposal proposal, final int distance) throws Exception {
    TypedProperties props = new TypedProperties();
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, proposal.getGroupId());
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, proposal.getClusterName());
    props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
    props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
    props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
    Notification notification = new Notification(null, CoreNotificationType.PROPOSAL, props);
    managementService.sendNotification(notification);
    return null;
}

3. RemoteGroupingHandler#createProposalNotification()

Project: activemq-artemis
File: RemoteGroupingHandler.java
private Notification createProposalNotification(SimpleString groupId, SimpleString clusterName) {
    TypedProperties props = new TypedProperties();
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, groupId);
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, clusterName);
    props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
    props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
    props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0);
    return new Notification(null, CoreNotificationType.PROPOSAL, props);
}

4. GroupHandlingAbstract#sendUnproposal()

Project: activemq-artemis
File: GroupHandlingAbstract.java
protected void sendUnproposal(SimpleString groupid, SimpleString clusterName, int distance) {
    TypedProperties props = new TypedProperties();
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, groupid);
    props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, clusterName);
    props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
    props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
    props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
    Notification notification = new Notification(null, CoreNotificationType.UNPROPOSAL, props);
    try {
        managementService.sendNotification(notification);
    } catch (Exception e) {
        ActiveMQServerLogger.LOGGER.errorHandlingMessage(e);
    }
}

5. PostOfficeImpl#addBinding()

Project: activemq-artemis
File: PostOfficeImpl.java
// PostOffice implementation -----------------------------------------------
// TODO - needs to be synchronized to prevent happening concurrently with activate()
// (and possible removeBinding and other methods)
// Otherwise can have situation where createQueue comes in before failover, then failover occurs
// and post office is activated but queue remains unactivated after failover so delivery never occurs
// even though failover is complete
@Override
public synchronized void addBinding(final Binding binding) throws Exception {
    addressManager.addBinding(binding);
    TypedProperties props = new TypedProperties();
    props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, binding.getType().toInt());
    props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
    props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
    props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
    props.putLongProperty(ManagementHelper.HDR_BINDING_ID, binding.getID());
    props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance());
    Filter filter = binding.getFilter();
    if (filter != null) {
        props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString());
    }
    String uid = UUIDGenerator.getInstance().generateStringUUID();
    if (logger.isDebugEnabled()) {
        logger.debug("ClusterCommunication::Sending notification for addBinding " + binding + " from server " + server);
    }
    managementService.sendNotification(new Notification(uid, CoreNotificationType.BINDING_ADDED, props));
}

6. JMSServerManagerImpl#sendNotification()

Project: activemq-artemis
File: JMSServerManagerImpl.java
private void sendNotification(JMSNotificationType type, String message) {
    TypedProperties prop = new TypedProperties();
    prop.putSimpleStringProperty(JMSNotificationType.MESSAGE, SimpleString.toSimpleString(message));
    Notification notif = new Notification(null, type, prop);
    try {
        server.getManagementService().sendNotification(notif);
    } catch (Exception e) {
        ActiveMQJMSServerLogger.LOGGER.failedToSendNotification(notif.toString());
    }
}

7. ActiveMQServerControlImpl#onNotification()

Project: activemq-artemis
File: ActiveMQServerControlImpl.java
@Override
public void onNotification(org.apache.activemq.artemis.core.server.management.Notification notification) {
    if (!(notification.getType() instanceof CoreNotificationType))
        return;
    CoreNotificationType type = (CoreNotificationType) notification.getType();
    TypedProperties prop = notification.getProperties();
    this.broadcaster.sendNotification(new Notification(type.toString(), this, notifSeq.incrementAndGet(), notification.toString()));
}

8. JMSServerControlImpl#onNotification()

Project: activemq-artemis
File: JMSServerControlImpl.java
@Override
public void onNotification(org.apache.activemq.artemis.core.server.management.Notification notification) {
    if (!(notification.getType() instanceof JMSNotificationType))
        return;
    JMSNotificationType type = (JMSNotificationType) notification.getType();
    TypedProperties prop = notification.getProperties();
    this.broadcaster.sendNotification(new Notification(type.toString(), this, notifSeq.incrementAndGet(), prop.getSimpleStringProperty(JMSNotificationType.MESSAGE).toString()));
}

9. MapMessageUtil#readBodyMap()

Project: activemq-artemis
File: MapMessageUtil.java
/**
    * Utility method to set the map on a message body
    */
public static TypedProperties readBodyMap(ActiveMQBuffer message) {
    TypedProperties map = new TypedProperties();
    readBodyMap(message, map);
    return map;
}