Package com.linkedin.databus2.core

Examples of com.linkedin.databus2.core.DatabusException


                                                                  false,
                                                                  _relayInboundStatsCollector);
            if ( length < 0)
            {
              _log.error("Unable to append DBChangeEntry (" + c + ") to event buffer !! EVB State : " + _eventBuffer);
              throw new DatabusException("Unable to append DBChangeEntry (" + c + ") to event buffer !!");
            }
            dbUpdatesEventsSize += length;
          } catch (DatabusException e) {
            _log.error("Got databus exception :", e);
            perSourceStats.addError();
View Full Code Here


  public PrimaryKeySchema(String pKey) throws DatabusException
  {
    if (pKey == null)
    {
      throw new DatabusException("PrimaryKey cannot be null");
    }
    _pKey = pKey;
    String[] pKeyList = _pKey.split(DbusConstants.COMPOUND_KEY_SEPARATOR);
    assert (pKeyList.length >= 1);
    for (String s: pKeyList)
View Full Code Here

    // Build PrimaryKeySchema
    String pkFieldName = SchemaHelper.getMetaField(schema, "pk");
    if(pkFieldName == null)
    {
      throw new DatabusException("No primary key specified in the schema");
    }

    PrimaryKeySchema pkSchema = new PrimaryKeySchema(pkFieldName);
    List<Schema.Field> fields = schema.getFields();
    List<KeyPair> kpl = new ArrayList<KeyPair>();
View Full Code Here

    });

    // Build Map<AvroFieldType, Columns>
    if (orderedFields.size() != cols.size())
    {
      throw new DatabusException("Mismatch in db schema vs avro schema");
    }

    int cnt = 0;
    Map<String, Column> avroFieldCol = new HashMap<String, Column>();

    for(Schema.Field field : orderedFields)
    {
      avroFieldCol.put(field.name(), cols.get(cnt));
      cnt++;
    }

    for(Schema.Field field : orderedFields)
    {
      if(field.schema().getType() == Schema.Type.ARRAY)
      {
        throw new DatabusException("The parser cannot handle ARRAY datatypes. Found in field: "+ field);
      }
      else
      {
        // The current database field being processed
        // (field is avro field name  and databaseFieldName is oracle field name (one to one mapping)
View Full Code Here

    String keyName = SchemaHelper.getMetaField(_eventSchema, "pk");

    if(keyName == null)
    {
      throw new DatabusException("The event schema is missing the required field \"key\".");
    }

    _pKeySchema = new PrimaryKeySchema(keyName);
  }
View Full Code Here

   */
  private Object obtainKey(DbChangeEntry dbChangeEntry)
      throws DatabusException
  {
    if (null == dbChangeEntry) {
      throw new DatabusException("DBUpdateImage is null");
    }
    List<KeyPair> pairs = dbChangeEntry.getPkeys();
    if (null == pairs || pairs.size() == 0) {
      throw new DatabusException("There do not seem to be any keys");
    }

    if (pairs.size() == 1) {
      Object key = pairs.get(0).getKey();
      Schema.Type pKeyType = pairs.get(0).getKeyType();
      Object keyObj = null;
      if (pKeyType == Schema.Type.INT)
      {
        if (key instanceof Integer)
        {
          keyObj = key;
        }
        else
        {
          throw new DatabusException(
              "Schema.Type does not match actual key type (INT) "
                  + key.getClass().getName());
        }

      } else if (pKeyType == Schema.Type.LONG)
      {
        if (key instanceof Long)
        {
          keyObj = key;
        }
        else
        {
          throw new DatabusException(
              "Schema.Type does not match actual key type (LONG) "
                  + key.getClass().getName());
        }

        keyObj = key;
      }
      else
      {
        keyObj = key;
      }

      return keyObj;
    } else {
      // Treat multiple keys as a separate case to avoid unnecessary casts
      Iterator<KeyPair> li = pairs.iterator();
      StringBuilder compositeKey = new StringBuilder();
      while (li.hasNext())
      {
        KeyPair kp = li.next();
        Schema.Type pKeyType = kp.getKeyType();
        Object key = kp.getKey();
        if (pKeyType == Schema.Type.INT)
        {
          if (key instanceof Integer)
            compositeKey.append(kp.getKey().toString());
          else
            throw new DatabusException(
                "Schema.Type does not match actual key type (INT) "
                    + key.getClass().getName());
        }
        else if (pKeyType == Schema.Type.LONG)
        {
          if (key instanceof Long)
            compositeKey.append(key.toString());
          else
            throw new DatabusException(
                "Schema.Type does not match actual key type (LONG) "
                    + key.getClass().getName());
        }
        else
        {
View Full Code Here

    {
      offset = _initialFileOffset;
      // Defensive Check to ensure we are getting the file we are expecting
      if ((null != _latestFile) && (! file.equals(_latestFile)) )
      {
        throw new DatabusException("Expected to get " + _latestFile + " but got " + file);
      }
      _firstTrailFile = false;
    } else {
      // Defensive Check to ensure we are not seeing old files.
      if (!_trailFileManager.isNextFileInSequence(_latestFile, file))
      {
        throw new DatabusException("Expected to get next file to " + _latestFile + " but got " + file);
      }
    }
    _latestFile = file;
    _streamEnumerator.enqueueNewTrailFile(new FilePosition(file, offset));
  }
View Full Code Here

      ckpt.setWindowScn(0L);
      ckpt.setFlexible();
    }
    else if (DtailCliBase.EOB_SCN == cli.getSinceScn())
    {
      throw new DatabusException("EOB checkpoint not supported by dtail yet");
    }
    else
    {
      ckpt.setConsumptionMode(DbusClientMode.ONLINE_CONSUMPTION);
      ckpt.setWindowScn(cli.getSinceScn());
View Full Code Here

      }

      catch(Exception ex)
      {
        _log.error("Failed to register the source statistics mbean for source (" + source.getSourceName() + ") due to an exception.", ex);
        throw new DatabusException("Failed to initialize event statistics mbeans.", ex);
      }
    }
    _sourceDBEventReader = new OracleTxlogEventReader(physicalSourceConfig.getName(), sources,
                                                      dataSource, eventBuffer, enableTracing,
                                                      dbusEventsStatisticsCollector,
View Full Code Here

      return new HttpRelay(relayStaticConfig, psourceConfBuilder.build(), getSourcesIdNameRegistry(),
                           schemaRegistry);
    }
    catch (IOException ioe)
    {
      throw new DatabusException("OracleRelay instantiation error: " + ioe.getMessage(), ioe);
    }
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus2.core.DatabusException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.