Hello,
I'm using the following EmaConfig.xml and all work fine and I want to switch to programmatic configuration. The ChannelSet section work fine (I see my channel names "Channel_1" and "Channel_2" in log) but it use localhost for each channel entries instead of "trep1" and "trep2". What is wrong?
Working EmaConfig.xml:
<?xml version="1.0" encoding="UTF-8"?>
<EmaConfig>
<ConsumerGroup>
<DefaultConsumer value="Consumer_1" />
<ConsumerList>
<Consumer>
<Name value="Consumer_1" />
<ChannelSet value="Channel_1,Channel_2" />
</Consumer>
</ConsumerList>
</ConsumerGroup>
<ChannelGroup>
<ChannelList>
<Channel>
<Name value="Channel_1" />
<Host value="trep1" />
<Port value="14002" />
</Channel>
<Channel>
<Name value="Channel_2" />
<Host value="trep1" />
<Port value="14002" />
</Channel>
</ChannelList>
</ChannelGroup>
</EmaConfig>
Non working Java code:
static Map createConfig() {
Map innerMap = EmaFactory.createMap();
Map configMap = EmaFactory.createMap();
ElementList elementList = EmaFactory.createElementList();
ElementList innerElementList = EmaFactory.createElementList();
elementList.add(EmaFactory.createElementEntry().ascii("DefaultConsumer", "Consumer_1"));
innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelSet", "Channel_1,Channel_2"));
innerMap.add(EmaFactory.createMapEntry().keyAscii("Consumer_1", MapEntry.MapAction.ADD, innerElementList));
innerElementList.clear();
elementList.add(EmaFactory.createElementEntry().map("ConsumerList", innerMap));
innerMap.clear();
configMap.add(EmaFactory.createMapEntry().keyAscii("ConsumerGroup", MapEntry.MapAction.ADD, elementList));
elementList.clear();
innerElementList.add(EmaFactory.createElementEntry().ascii("Host", "trep1"));
innerElementList.add(EmaFactory.createElementEntry().ascii("Port", "14002"));
innerMap.add(EmaFactory.createMapEntry().keyAscii("Channel_1", MapEntry.MapAction.ADD, innerElementList));
innerElementList.clear();
innerElementList.add(EmaFactory.createElementEntry().ascii("Host", "trep2"));
innerElementList.add(EmaFactory.createElementEntry().ascii("Port", "14002"));
innerMap.add(EmaFactory.createMapEntry().keyAscii("Channel_2", MapEntry.MapAction.ADD, innerElementList));
innerElementList.clear();
elementList.add(EmaFactory.createElementEntry().map("ChannelList", innerMap));
innerMap.clear();
configMap.add(EmaFactory.createMapEntry().keyAscii("ChannelGroup", MapEntry.MapAction.ADD, elementList));
elementList.clear();
return configMap;
}
Thanks
Stephane