当前位置: 首页>>代码示例>>Java>>正文


Java MessagingException类代码示例

本文整理汇总了Java中com.esri.ges.messaging.MessagingException的典型用法代码示例。如果您正苦于以下问题:Java MessagingException类的具体用法?Java MessagingException怎么用?Java MessagingException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessagingException类属于com.esri.ges.messaging包,在下文中一共展示了MessagingException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findAndCreate

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private GeoEvent findAndCreate(String name)
{
	Collection<GeoEventDefinition> results = geoEventCreator.getGeoEventDefinitionManager().searchGeoEventDefinitionByName(name);
	if (!results.isEmpty())
	{
		try
		{
			return geoEventCreator.create(results.iterator().next().getGuid());
		}
		catch (MessagingException e)
		{
			LOG.error("GeoEvent creation failed: " + e.getMessage());
		}
	}
	else
		LOG.error("GeoEvent creation failed: GeoEvent definition '" + name + "' not found.");
	return null;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:19,代码来源:DefenseInboundAdapter.java

示例2: createLine2PtGeoevent

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private GeoEvent createLine2PtGeoevent(GeoEvent event, MapGeometry outGeo, Date ts) throws MessagingException, FieldException
{
	GeoEventCreator creator = messaging.createGeoEventCreator();
	GeoEvent msg = creator.create(outDef, definition.getUri().toString());
	for(FieldDefinition fd: event.getGeoEventDefinition().getFieldDefinitions())
	{
		if(fd.getTags().contains("GEOMETRY"))
		{
			msg.setGeometry(outGeo);
		}
		else
		{
			msg.setField(fd.getName(), event.getField(fd.getName()));
		}
		msg.setField("TIMESTAMP", ts);

	}
	return msg;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:20,代码来源:Line2PtProcessor.java

示例3: KafkaEventProducer

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
KafkaEventProducer(EventDestination destination, String bootstrap) {
  super(destination);
  // http://kafka.apache.org/documentation.html#producerconfigs
  props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrap);
  props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer");
  props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer");
  props.put(ProducerConfig.CLIENT_ID_CONFIG, "kafka-for-geoevent");
  // props.put("partitioner.class", "kafka.producer.DefaultPartitioner");
  // props.put(ProducerConfig.ACKS_CONFIG, "0");
  // props.put(ProducerConfig.RECONNECT_BACKOFF_MS_CONFIG, "0");
  // props.put(ProducerConfig.RETRY_BACKOFF_MS_CONFIG, "0");
  // props.put(ProducerConfig.RETRIES_CONFIG, "0");
  try {
    setup();
  }
  catch (MessagingException e) {
    setDisconnected(e);
  }
}
 
开发者ID:Esri,项目名称:kafka-for-geoevent,代码行数:20,代码来源:KafkaOutboundTransport.java

示例4: send

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
public void send(final ByteBuffer bb, int h) throws MessagingException {
  // wait to send messages if we are not connected
  if (isConnected())
  {
    byte[] key = new byte[4];
    key[3] = (byte) (h & 0xFF);
    key[2] = (byte) ((h >> 8) & 0xFF);
    key[1] = (byte) ((h >> 16) & 0xFF);
    key[0] = (byte) ((h >> 24) & 0xFF);
    ProducerRecord<byte[], byte[]> record = new ProducerRecord<byte[], byte[]>(destination.getName(), key, bb.array());
    producer.send(record, new Callback() {
      @Override
      public void onCompletion(RecordMetadata metadata, Exception e) {
        if (e != null) {
          String errorMsg = LOGGER.translate("KAFKA_SEND_FAILURE_ERROR", destination.getName(), e.getMessage());
          LOGGER.error(errorMsg);
        }
        else
          LOGGER.debug("The offset of the record we just sent is: " + metadata.offset());
      }
    });
  }
}
 
开发者ID:Esri,项目名称:kafka-for-geoevent,代码行数:24,代码来源:KafkaOutboundTransport.java

示例5: run

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
@Override
public void run()
{
  setErrorMessage("");
  setRunningState(RunningState.STARTED);
  while (isRunning())
  {
    try
    {
      byte[] bytes = consumer.receive();
      if (bytes != null && bytes.length > 0) {
        ByteBuffer bb = ByteBuffer.allocate(bytes.length);
        bb.put(bytes);
        bb.flip();
        byteListener.receive(bb, "");
        bb.clear();
      }
    }
    catch (MessagingException e)
    {
      LOGGER.error("", e);
    }
  }
}
 
开发者ID:Esri,项目名称:kafka-for-geoevent,代码行数:25,代码来源:KafkaInboundTransport.java

示例6: receive

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
byte[] receive() throws MessagingException {
  // wait to receive messages if we are not connected
  if (!isConnected())
  {
    try
    {
      connectionLock.acquire(); // blocks execution until a connection has been recovered
    }
    catch (InterruptedException error)
    {
      ; // ignored
    }
  }
  byte[] bytes = null;
  try
  {
    bytes = queue.poll(100, TimeUnit.MILLISECONDS);
  }
  catch (Exception e)
  {
    ; // ignore
  }
  return bytes;
}
 
开发者ID:Esri,项目名称:kafka-for-geoevent,代码行数:25,代码来源:KafkaInboundTransport.java

示例7: process

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception, MalformedURLException, JSONException
{
	try
    {

	Point point = (Point) geoEvent.getGeometry().getGeometry();
	double lon = point.getX();
	double lat = point.getY();
	int wkid = geoEvent.getGeometry().getSpatialReference().getID();

	//fetch nearby OpenStreetmap Points of Interest via geoNames web service
	URL geoNamesNearbyOSMPOIsURL = new URL("http://api.geonames.org/findNearbyPOIsOSMJSON?lat=" + Double.toString(lat) + "&lng=" + Double.toString(lon) + "&username=" + geoNamesUsername + "&radius=" + Double.toString(geoNamesNearbyOSMPOIsRadius) + "&maxRows=" + Integer.toString(geoNamesNearbyOSMPOIsMaxRows));		
	String responseOSMPOI = getReverseGeocode(geoNamesNearbyOSMPOIsURL);
	createOSMPOIGeoEvent(geoEvent,responseOSMPOI);
	
	}
	catch (MessagingException e)
	{
		LOGGER.error("EVENT_SEND_FAILURE", e);
	}
	return null;
}
 
开发者ID:Esri,项目名称:geonames-for-geoevent,代码行数:24,代码来源:GeoNamesOSMPOIProcessor.java

示例8: process

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
@Override
public GeoEvent process(GeoEvent geoEvent) throws Exception, MalformedURLException, JSONException
{
	try
	{

		Point point = (Point) geoEvent.getGeometry().getGeometry();
		double lon = point.getX();
		double lat = point.getY();
		int wkid = geoEvent.getGeometry().getSpatialReference().getID();

		// fetch nearby Wikipedia articles via geoNames web service
		String geoNamesLang = "en"; // lang : language code (around 240 languages) (default = en)
		URL geoNamesWikipediaURL = new URL("http://api.geonames.org/findNearbyWikipediaJSON?lat=" + Double.toString(lat) + "&lng=" + Double.toString(lon) + "&username=" + geoNamesUsername + "&lang=" + geoNamesLang + "&radius=" + Double.toString(geoNamesWikipediaRadius) + "&maxRows=" + Integer.toString(geoNamesWikipediaMaxRows));
		String responseWikipedia = getReverseGeocode(geoNamesWikipediaURL);
		createWikipediaGeoEvent(geoEvent, responseWikipedia);

	}
	catch (MessagingException e)
	{
		LOGGER.error("EVENT_SEND_FAILURE", e);
	}
	return null;
}
 
开发者ID:Esri,项目名称:geonames-for-geoevent,代码行数:25,代码来源:GeoNamesWikipediaProcessor.java

示例9: populateGeoEvent

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private GeoEvent populateGeoEvent(GeoEvent geoEvent, GeoEventDefinition edOut, Object outputGeometry) throws MessagingException
{
	GeoEvent outGeoEvent;
	if (outputGeometry == null)
		outGeoEvent = geoEventCreator.create(edOut.getGuid(), geoEvent.getAllFields());
	else
		outGeoEvent = geoEventCreator.create(edOut.getGuid(), new Object[] { geoEvent.getAllFields(), outputGeometry });

	outGeoEvent.setProperty(GeoEventPropertyName.TYPE, geoEvent.getProperty(GeoEventPropertyName.TYPE));
	outGeoEvent.setProperty(GeoEventPropertyName.OWNER_ID, geoEvent.getProperty(GeoEventPropertyName.OWNER_ID));
	outGeoEvent.setProperty(GeoEventPropertyName.OWNER_URI, geoEvent.getProperty(GeoEventPropertyName.OWNER_URI));

	for (Map.Entry<GeoEventPropertyName, Object> property : geoEvent.getProperties())
	{
		if (!outGeoEvent.hasProperty(property.getKey()))
			outGeoEvent.setProperty(property.getKey(), property.getValue());
	}

	return outGeoEvent;
}
 
开发者ID:Esri,项目名称:service-area-calculator-for-geoevent,代码行数:21,代码来源:ServiceAreaCalculator.java

示例10: sendReport

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private void sendReport()
{
  if (notificationMode != MotionCalculatorNotificationMode.OnChange)
  {
    return;
  }

  LOGGER.debug("sendReport");

  try
  {
    GeoEvent outGeoEvent = createMotionGeoEvent();
    if (outGeoEvent == null)
    {
      LOGGER.debug("outGeoEvent is null");
      return;
    }
    LOGGER.debug(outGeoEvent.toString());
    send(outGeoEvent);
  }
  catch (MessagingException e)
  {
    LOGGER.error("Error sending update GeoEvent for " + id, e);
  }
}
 
开发者ID:Esri,项目名称:motion-calculator-for-geoevent,代码行数:26,代码来源:MotionCalculator.java

示例11: parseFeaturesToStops

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private List<Stop> parseFeaturesToStops(List<JsonNode> nodes)
{
  GeoEvent geoEvent;
  List <Stop> stops = new ArrayList<Stop>();
  try
  {
    geoEvent = geoEventCreator.create(stopGEDName, stopGEDOwner);
    List<GeoEvent> geoEvents = FeatureUtil.convertFeaturesToGeoEvents(nodes, spatial, geoEventCreator, geoEvent.getGeoEventDefinition());
    for(GeoEvent ge : geoEvents)
    {
      Stop stop = createStop((String)ge.getField( StopResource.STOP_NAME_KEY ));
      convertGeoEventToStop(ge, stop);
      stops.add(stop);
    }
  }
  catch (MessagingException e)
  {
    log.error(e);
  }
  
  return stops;
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:23,代码来源:StopsManagerImpl.java

示例12: parseFeaturesToVehicles

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private List<Vehicle> parseFeaturesToVehicles(List<JsonNode> nodes)
{
  GeoEvent geoEvent;
  List <Vehicle> vehicles = new ArrayList<Vehicle>();
  try
  {
    geoEvent = geoEventCreator.create(vehicleGEDName, vehicleGEDOwner);
    List<GeoEvent> geoEvents = FeatureUtil.convertFeaturesToGeoEvents(nodes, spatial, geoEventCreator, geoEvent.getGeoEventDefinition());
    for(GeoEvent ge : geoEvents)
    {
      Vehicle vehicle = createVehicleFromGeoEvent( ge );
      vehicles.add(vehicle);
    }
  }
  catch (MessagingException e)
  {
    log.error(e);
  }
  
  return vehicles;
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:22,代码来源:VehiclesManagerImpl.java

示例13: parseFeaturesToRoutes

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private List<Route> parseFeaturesToRoutes(List<JsonNode> nodes)
{
  GeoEvent geoEvent;
  List <Route> routes = new ArrayList<Route>();
  try
  {
    geoEvent = geoEventCreator.create(routeGEDName, routeGEDOwner);
    List<GeoEvent> geoEvents = FeatureUtil.convertFeaturesToGeoEvents(nodes, spatial, geoEventCreator, geoEvent.getGeoEventDefinition());
    for(GeoEvent ge : geoEvents)
    {
      Route route = convertGeoEventToRoute( ge );
      routes.add(route);
    }
  }
  catch (MessagingException e)
  {
    log.error(e);
  }
  
  return routes;
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:22,代码来源:RouteManagerImpl.java

示例14: send

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
@Override
public void send(GeoEvent msg) throws MessagingException
{
  if(geoEventProducer == null)
  {
    if(messaging == null)
    {
      LOG.error("Messaging is null.  Unable to create geoEventProducer.");
      return;
    }
    destination = new EventDestination(getId() + ":event");
    geoEventProducer = messaging.createGeoEventProducer(destination.getName());
    if(geoEventProducer == null)
    {
      LOG.error("Unable to create geoEventProducer.");
      return;
    }
  }
  geoEventProducer.send(msg);
}
 
开发者ID:Esri,项目名称:route-monitor-for-geoevent,代码行数:21,代码来源:StopProcessor.java

示例15: parseEvent

import com.esri.ges.messaging.MessagingException; //导入依赖的package包/类
private GeoEvent parseEvent(String data)
{
	// Create an instance of the message using the guid that we generated when
	// we started up.
	GeoEvent msg;
	try
	{
		msg = geoEventCreator.create(((AdapterDefinition)definition).getGeoEventDefinition("CAPAlert").getGuid());
	}
	catch (MessagingException e)
	{
		return null;
	}
	return msg;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:16,代码来源:CAPInboundAdapter.java


注:本文中的com.esri.ges.messaging.MessagingException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。