How to get hostname in TIBCO BusinessEvents Rule/Rule Function

How to get hostname in TIBCO BusinessEvents Rule/Rule Function

book

Article ID: KB0077345

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition 5.5.0

Description

How to get hostname in BE Rule/Rule Function. This may be required in case BE application is running in Cloud / Kubernetes (k8s) Pod.

Issue/Introduction

How to get hostname in TIBCO BusinessEvents Rule/Rule Function

Environment

All

Resolution

One could use the following code in rule/rulefunction and then use $hostName in XPATH mapper. (attached sample)
===
Object localHost = System.execJava("java.net.InetAddress", "getLocalHost", null, null, null);
Object hostName = System.execJava("java.net.InetAddress", "getHostName",null, localHost, null);
System.debugOut("#### Machine name is " + hostName);
System.debugOut("##### Machine name is " + hostName + " localhost=" + localHost);
====
Alternatively, you could create your custom java function in BE with something similar and reuse in multiple rules/rule functions. Please refer to :- https://docs.tibco.com/pub/businessevents-enterprise/5.5.0/doc/pdf/TIB_businessevents-standard_5.5_developers_guide.pdf?id=7

Attachments

How to get hostname in TIBCO BusinessEvents Rule/Rule Function get_app