Tabnine Logo
SetConfig.getMessageMap
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessageMap
method
in
org.apache.samza.coordinator.stream.messages.SetConfig

Best Java code snippets using org.apache.samza.coordinator.stream.messages.SetConfig.getMessageMap (Showing top 4 results out of 315)

origin: apache/samza

SetConfig setConfigMessage = new SetConfig(message);
key = setConfigMessage.getKey();
Map<String, String> valuesMap = (Map<String, String>) setConfigMessage.getMessageMap().get("values");
String value = null;
if (valuesMap != null) {
origin: apache/samza

 @Override
 public byte[] toBytes(String value) {
  if (type.equalsIgnoreCase(SetContainerHostMapping.TYPE)) {
   SetContainerHostMapping hostMapping = new SetContainerHostMapping(SOURCE, "", value, "", "");
   return messageSerde.toBytes(hostMapping.getMessageMap());
  } else if (type.equalsIgnoreCase(SetTaskContainerMapping.TYPE)) {
   SetTaskContainerMapping setTaskContainerMapping = new SetTaskContainerMapping(SOURCE, "", value);
   return messageSerde.toBytes(setTaskContainerMapping.getMessageMap());
  } else if (type.equalsIgnoreCase(SetTaskModeMapping.TYPE)) {
   SetTaskModeMapping setTaskModeMapping = new SetTaskModeMapping(SOURCE, "", value);
   return messageSerde.toBytes(setTaskModeMapping.getMessageMap());
  } else if (type.equalsIgnoreCase(SetChangelogMapping.TYPE)) {
   SetChangelogMapping changelogMapping = new SetChangelogMapping(SOURCE, "", Integer.valueOf(value));
   return messageSerde.toBytes(changelogMapping.getMessageMap());
  } else if (type.equalsIgnoreCase(SetConfig.TYPE)) {
   SetConfig setConfig = new SetConfig(SOURCE, "", value);
   return messageSerde.toBytes(setConfig.getMessageMap());
  } else {
   throw new SamzaException(String.format("Unknown coordinator stream message type: %s", type));
  }
 }
}
origin: apache/samza

private void convertConfigToCoordinatorMessage(Config config) {
 try {
  for (Map.Entry<String, String> configPair : config.entrySet()) {
   byte[] keyBytes = null;
   byte[] messgeBytes = null;
   if (configPair.getKey().startsWith(CHANGELOGPREFIX)) {
    String[] changelogInfo = configPair.getKey().split(":");
    String changeLogPartition = configPair.getValue();
    SetChangelogMapping changelogMapping = new SetChangelogMapping(changelogInfo[1], changelogInfo[2], Integer.parseInt(changeLogPartition));
    keyBytes = MAPPER.writeValueAsString(changelogMapping.getKeyArray()).getBytes("UTF-8");
    messgeBytes = MAPPER.writeValueAsString(changelogMapping.getMessageMap()).getBytes("UTF-8");
   } else {
    SetConfig setConfig = new SetConfig("source", configPair.getKey(), configPair.getValue());
    keyBytes = MAPPER.writeValueAsString(setConfig.getKeyArray()).getBytes("UTF-8");
    messgeBytes = MAPPER.writeValueAsString(setConfig.getMessageMap()).getBytes("UTF-8");
   }
   // The ssp here is the coordinator ssp (which is always fixed) and not the task ssp.
   put(systemStreamPartition, new IncomingMessageEnvelope(systemStreamPartition, "", keyBytes, messgeBytes));
  }
  setIsAtHead(systemStreamPartition, true);
 } catch (Exception e) {
  throw new SamzaException(e);
 }
}
origin: apache/samza

public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll(Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException {
 Map<SystemStreamPartition, List<IncomingMessageEnvelope>> map = new LinkedHashMap<SystemStreamPartition, List<IncomingMessageEnvelope>>();
 assertEquals(1, systemStreamPartitions.size());
 SystemStreamPartition systemStreamPartition = systemStreamPartitions.iterator().next();
 assertEquals(expectedSystemStreamPartition, systemStreamPartition);
 if (pollCount++ == 0) {
  List<IncomingMessageEnvelope> list = new ArrayList<IncomingMessageEnvelope>();
  SetConfig setConfig1 = new SetConfig("test", "job.name", "my-job-name");
  SetConfig setConfig2 = new SetConfig("test", "job.id", "1234");
  Delete delete = new Delete("test", "job.name", SetConfig.TYPE);
  list.add(new IncomingMessageEnvelope(systemStreamPartition, null, serialize(setConfig1.getKeyArray()), serialize(setConfig1.getMessageMap())));
  list.add(new IncomingMessageEnvelope(systemStreamPartition, null, serialize(setConfig2.getKeyArray()), serialize(setConfig2.getMessageMap())));
  list.add(new IncomingMessageEnvelope(systemStreamPartition, null, serialize(delete.getKeyArray()), delete.getMessageMap()));
  map.put(systemStreamPartition, list);
 }
 return map;
}
org.apache.samza.coordinator.stream.messagesSetConfiggetMessageMap

Popular methods of SetConfig

  • <init>
    The SetConfig message is used to store a specific configuration.
  • getConfigValue
    Return the configuration value as a string.
  • getMessageValue
  • putMessageValue
  • setKey
  • setType
  • getKey
  • equals
  • getKeyArray
  • getType
  • getVersion
  • hashCode
  • getVersion,
  • hashCode,
  • isDelete

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Notification (javax.management)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Option (scala)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now